
(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 10 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 75.8%
Taylor expanded in K around 0 97.0%
cos-neg97.0%
Simplified97.0%
Final simplification97.0%
(FPCore (K m n M l) :precision binary64 (pow E (- (- (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 pow(((double) M_E), ((fabs((m - n)) - l) - pow((((m + n) * 0.5) - M), 2.0)));
}
public static double code(double K, double m, double n, double M, double l) {
return Math.pow(Math.E, ((Math.abs((m - n)) - l) - Math.pow((((m + n) * 0.5) - M), 2.0)));
}
def code(K, m, n, M, l): return math.pow(math.e, ((math.fabs((m - n)) - l) - math.pow((((m + n) * 0.5) - M), 2.0)))
function code(K, m, n, M, l) return exp(1) ^ Float64(Float64(abs(Float64(m - n)) - l) - (Float64(Float64(Float64(m + n) * 0.5) - M) ^ 2.0)) end
function tmp = code(K, m, n, M, l) tmp = 2.71828182845904523536 ^ ((abs((m - n)) - l) - ((((m + n) * 0.5) - M) ^ 2.0)); end
code[K_, m_, n_, M_, l_] := N[Power[E, N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[Power[N[(N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
{e}^{\left(\left(\left|m - n\right| - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}\right)}
\end{array}
Initial program 75.8%
Taylor expanded in n around inf 84.7%
associate-*r*84.7%
Simplified84.7%
Taylor expanded in K around 0 96.2%
*-un-lft-identity96.2%
exp-prod96.2%
associate--r+96.2%
fabs-sub96.2%
fma-neg96.2%
Applied egg-rr96.2%
exp-1-e96.2%
fabs-sub96.2%
unpow296.2%
cancel-sign-sub-inv96.2%
+-commutative96.2%
*-lft-identity96.2%
metadata-eval96.2%
cancel-sign-sub-inv96.2%
fma-neg96.2%
+-commutative96.2%
*-lft-identity96.2%
metadata-eval96.2%
cancel-sign-sub-inv96.2%
fma-neg96.2%
Simplified96.2%
Final simplification96.2%
(FPCore (K m n M l) :precision binary64 (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 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 = 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.exp((Math.abs((m - n)) - (l + Math.pow((((m + n) * 0.5) - M), 2.0))));
}
def code(K, m, n, M, l): return math.exp((math.fabs((m - n)) - (l + math.pow((((m + n) * 0.5) - M), 2.0))))
function code(K, m, n, M, l) return 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 = exp((abs((m - n)) - (l + ((((m + n) * 0.5) - M) ^ 2.0)))); end
code[K_, m_, n_, M_, l_] := 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]
\begin{array}{l}
\\
e^{\left|m - n\right| - \left(\ell + {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}\right)}
\end{array}
Initial program 75.8%
Taylor expanded in n around inf 84.7%
associate-*r*84.7%
Simplified84.7%
Taylor expanded in K around 0 96.2%
Final simplification96.2%
(FPCore (K m n M l) :precision binary64 (if (<= m -1000000000.0) (exp (* (pow m 2.0) -0.25)) (pow E (- (* (- (* n 0.5) M) (- (- M (* n 0.5)) m)) (- l (fabs (- m n)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -1000000000.0) {
tmp = exp((pow(m, 2.0) * -0.25));
} else {
tmp = pow(((double) M_E), ((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) - (l - fabs((m - n)))));
}
return tmp;
}
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -1000000000.0) {
tmp = Math.exp((Math.pow(m, 2.0) * -0.25));
} else {
tmp = Math.pow(Math.E, ((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) - (l - Math.abs((m - n)))));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -1000000000.0: tmp = math.exp((math.pow(m, 2.0) * -0.25)) else: tmp = math.pow(math.e, ((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) - (l - math.fabs((m - n))))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -1000000000.0) tmp = exp(Float64((m ^ 2.0) * -0.25)); else tmp = exp(1) ^ Float64(Float64(Float64(Float64(n * 0.5) - M) * Float64(Float64(M - Float64(n * 0.5)) - m)) - Float64(l - abs(Float64(m - n)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -1000000000.0) tmp = exp(((m ^ 2.0) * -0.25)); else tmp = 2.71828182845904523536 ^ ((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) - (l - abs((m - n)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -1000000000.0], N[Exp[N[(N[Power[m, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision], N[Power[E, N[(N[(N[(N[(n * 0.5), $MachinePrecision] - M), $MachinePrecision] * N[(N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision] - m), $MachinePrecision]), $MachinePrecision] - N[(l - N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1000000000:\\
\;\;\;\;e^{{m}^{2} \cdot -0.25}\\
\mathbf{else}:\\
\;\;\;\;{e}^{\left(\left(n \cdot 0.5 - M\right) \cdot \left(\left(M - n \cdot 0.5\right) - m\right) - \left(\ell - \left|m - n\right|\right)\right)}\\
\end{array}
\end{array}
if m < -1e9Initial program 68.9%
Taylor expanded in n around inf 91.8%
associate-*r*91.8%
Simplified91.8%
Taylor expanded in K around 0 100.0%
Taylor expanded in n around 0 91.9%
+-commutative91.9%
unpow291.9%
distribute-rgt-out95.2%
Simplified95.2%
Taylor expanded in m around inf 100.0%
*-commutative100.0%
Simplified100.0%
if -1e9 < m Initial program 77.9%
Taylor expanded in n around inf 82.4%
associate-*r*82.4%
Simplified82.4%
Taylor expanded in K around 0 95.0%
*-un-lft-identity95.0%
exp-prod95.0%
associate--r+95.0%
fabs-sub95.0%
fma-neg95.0%
Applied egg-rr95.0%
exp-1-e95.0%
fabs-sub95.0%
unpow295.0%
cancel-sign-sub-inv95.0%
+-commutative95.0%
*-lft-identity95.0%
metadata-eval95.0%
cancel-sign-sub-inv95.0%
fma-neg95.0%
+-commutative95.0%
*-lft-identity95.0%
metadata-eval95.0%
cancel-sign-sub-inv95.0%
fma-neg95.0%
Simplified95.0%
Taylor expanded in m around 0 79.3%
+-commutative79.3%
unpow279.3%
distribute-rgt-out81.4%
Simplified81.4%
Final simplification85.8%
(FPCore (K m n M l) :precision binary64 (if (<= M 1.1e-13) (exp (+ (fabs (- m n)) (- (* (+ n (- (* m 0.5) M)) (- M (* m 0.5))) l))) (exp (- (pow M 2.0)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (M <= 1.1e-13) {
tmp = exp((fabs((m - n)) + (((n + ((m * 0.5) - M)) * (M - (m * 0.5))) - l)));
} else {
tmp = 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 <= 1.1d-13) then
tmp = exp((abs((m - n)) + (((n + ((m * 0.5d0) - m_1)) * (m_1 - (m * 0.5d0))) - l)))
else
tmp = 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 <= 1.1e-13) {
tmp = Math.exp((Math.abs((m - n)) + (((n + ((m * 0.5) - M)) * (M - (m * 0.5))) - l)));
} else {
tmp = Math.exp(-Math.pow(M, 2.0));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if M <= 1.1e-13: tmp = math.exp((math.fabs((m - n)) + (((n + ((m * 0.5) - M)) * (M - (m * 0.5))) - l))) else: tmp = math.exp(-math.pow(M, 2.0)) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (M <= 1.1e-13) tmp = exp(Float64(abs(Float64(m - n)) + Float64(Float64(Float64(n + Float64(Float64(m * 0.5) - M)) * Float64(M - Float64(m * 0.5))) - l))); else tmp = exp(Float64(-(M ^ 2.0))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (M <= 1.1e-13) tmp = exp((abs((m - n)) + (((n + ((m * 0.5) - M)) * (M - (m * 0.5))) - l))); else tmp = exp(-(M ^ 2.0)); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[M, 1.1e-13], N[Exp[N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] + N[(N[(N[(n + N[(N[(m * 0.5), $MachinePrecision] - M), $MachinePrecision]), $MachinePrecision] * N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq 1.1 \cdot 10^{-13}:\\
\;\;\;\;e^{\left|m - n\right| + \left(\left(n + \left(m \cdot 0.5 - M\right)\right) \cdot \left(M - m \cdot 0.5\right) - \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{-{M}^{2}}\\
\end{array}
\end{array}
if M < 1.09999999999999998e-13Initial program 74.7%
Taylor expanded in n around inf 83.7%
associate-*r*83.7%
Simplified83.7%
Taylor expanded in K around 0 95.3%
Taylor expanded in n around 0 70.0%
+-commutative70.0%
unpow270.0%
distribute-rgt-out75.9%
Simplified75.9%
if 1.09999999999999998e-13 < M Initial program 78.6%
Taylor expanded in n around inf 87.1%
associate-*r*87.1%
Simplified87.1%
Taylor expanded in K around 0 98.6%
Taylor expanded in n around 0 77.3%
+-commutative77.3%
unpow277.3%
distribute-rgt-out87.3%
Simplified87.3%
Taylor expanded in M around inf 95.8%
mul-1-neg95.8%
Simplified95.8%
Final simplification81.3%
(FPCore (K m n M l) :precision binary64 (if (<= m -110.0) (exp (* (pow m 2.0) -0.25)) (exp (+ (fabs (- m n)) (- (* (- (* n 0.5) M) (- (- M (* n 0.5)) m)) l)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -110.0) {
tmp = exp((pow(m, 2.0) * -0.25));
} else {
tmp = exp((fabs((m - n)) + ((((n * 0.5) - M) * ((M - (n * 0.5)) - 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 (m <= (-110.0d0)) then
tmp = exp(((m ** 2.0d0) * (-0.25d0)))
else
tmp = exp((abs((m - n)) + ((((n * 0.5d0) - m_1) * ((m_1 - (n * 0.5d0)) - m)) - 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 <= -110.0) {
tmp = Math.exp((Math.pow(m, 2.0) * -0.25));
} else {
tmp = Math.exp((Math.abs((m - n)) + ((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) - l)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -110.0: tmp = math.exp((math.pow(m, 2.0) * -0.25)) else: tmp = math.exp((math.fabs((m - n)) + ((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) - l))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -110.0) tmp = exp(Float64((m ^ 2.0) * -0.25)); else tmp = exp(Float64(abs(Float64(m - n)) + Float64(Float64(Float64(Float64(n * 0.5) - M) * Float64(Float64(M - Float64(n * 0.5)) - m)) - l))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -110.0) tmp = exp(((m ^ 2.0) * -0.25)); else tmp = exp((abs((m - n)) + ((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) - l))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -110.0], N[Exp[N[(N[Power[m, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision], N[Exp[N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] + N[(N[(N[(N[(n * 0.5), $MachinePrecision] - M), $MachinePrecision] * N[(N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision] - m), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -110:\\
\;\;\;\;e^{{m}^{2} \cdot -0.25}\\
\mathbf{else}:\\
\;\;\;\;e^{\left|m - n\right| + \left(\left(n \cdot 0.5 - M\right) \cdot \left(\left(M - n \cdot 0.5\right) - m\right) - \ell\right)}\\
\end{array}
\end{array}
if m < -110Initial program 68.9%
Taylor expanded in n around inf 91.8%
associate-*r*91.8%
Simplified91.8%
Taylor expanded in K around 0 100.0%
Taylor expanded in n around 0 91.9%
+-commutative91.9%
unpow291.9%
distribute-rgt-out95.2%
Simplified95.2%
Taylor expanded in m around inf 100.0%
*-commutative100.0%
Simplified100.0%
if -110 < m Initial program 77.9%
Taylor expanded in n around inf 82.4%
associate-*r*82.4%
Simplified82.4%
Taylor expanded in K around 0 95.0%
Taylor expanded in m around 0 79.3%
+-commutative79.3%
unpow279.3%
distribute-rgt-out81.4%
Simplified81.4%
Final simplification85.8%
(FPCore (K m n M l) :precision binary64 (if (or (<= M -21000000000000.0) (not (<= M 1.1e-13))) (exp (- (pow M 2.0))) (exp (* (pow m 2.0) -0.25))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((M <= -21000000000000.0) || !(M <= 1.1e-13)) {
tmp = exp(-pow(M, 2.0));
} else {
tmp = exp((pow(m, 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 ((m_1 <= (-21000000000000.0d0)) .or. (.not. (m_1 <= 1.1d-13))) then
tmp = exp(-(m_1 ** 2.0d0))
else
tmp = exp(((m ** 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 ((M <= -21000000000000.0) || !(M <= 1.1e-13)) {
tmp = Math.exp(-Math.pow(M, 2.0));
} else {
tmp = Math.exp((Math.pow(m, 2.0) * -0.25));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (M <= -21000000000000.0) or not (M <= 1.1e-13): tmp = math.exp(-math.pow(M, 2.0)) else: tmp = math.exp((math.pow(m, 2.0) * -0.25)) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((M <= -21000000000000.0) || !(M <= 1.1e-13)) tmp = exp(Float64(-(M ^ 2.0))); else tmp = exp(Float64((m ^ 2.0) * -0.25)); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((M <= -21000000000000.0) || ~((M <= 1.1e-13))) tmp = exp(-(M ^ 2.0)); else tmp = exp(((m ^ 2.0) * -0.25)); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[M, -21000000000000.0], N[Not[LessEqual[M, 1.1e-13]], $MachinePrecision]], N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision], N[Exp[N[(N[Power[m, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq -21000000000000 \lor \neg \left(M \leq 1.1 \cdot 10^{-13}\right):\\
\;\;\;\;e^{-{M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;e^{{m}^{2} \cdot -0.25}\\
\end{array}
\end{array}
if M < -2.1e13 or 1.09999999999999998e-13 < M Initial program 77.4%
Taylor expanded in n around inf 86.9%
associate-*r*86.9%
Simplified86.9%
Taylor expanded in K around 0 98.5%
Taylor expanded in n around 0 78.2%
+-commutative78.2%
unpow278.2%
distribute-rgt-out89.2%
Simplified89.2%
Taylor expanded in M around inf 97.1%
mul-1-neg97.1%
Simplified97.1%
if -2.1e13 < M < 1.09999999999999998e-13Initial program 73.9%
Taylor expanded in n around inf 82.1%
associate-*r*82.1%
Simplified82.1%
Taylor expanded in K around 0 93.5%
Taylor expanded in n around 0 64.7%
+-commutative64.7%
unpow264.7%
distribute-rgt-out67.3%
Simplified67.3%
Taylor expanded in m around inf 59.5%
*-commutative59.5%
Simplified59.5%
Final simplification79.6%
(FPCore (K m n M l) :precision binary64 (if (or (<= M -27.0) (not (<= M 1.75e-18))) (exp (- (pow M 2.0))) (exp (- l))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((M <= -27.0) || !(M <= 1.75e-18)) {
tmp = exp(-pow(M, 2.0));
} 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_1 <= (-27.0d0)) .or. (.not. (m_1 <= 1.75d-18))) then
tmp = exp(-(m_1 ** 2.0d0))
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 <= -27.0) || !(M <= 1.75e-18)) {
tmp = Math.exp(-Math.pow(M, 2.0));
} else {
tmp = Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (M <= -27.0) or not (M <= 1.75e-18): tmp = math.exp(-math.pow(M, 2.0)) else: tmp = math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((M <= -27.0) || !(M <= 1.75e-18)) tmp = exp(Float64(-(M ^ 2.0))); else tmp = exp(Float64(-l)); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((M <= -27.0) || ~((M <= 1.75e-18))) tmp = exp(-(M ^ 2.0)); else tmp = exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[M, -27.0], N[Not[LessEqual[M, 1.75e-18]], $MachinePrecision]], N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision], N[Exp[(-l)], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq -27 \lor \neg \left(M \leq 1.75 \cdot 10^{-18}\right):\\
\;\;\;\;e^{-{M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;e^{-\ell}\\
\end{array}
\end{array}
if M < -27 or 1.7499999999999999e-18 < M Initial program 77.3%
Taylor expanded in n around inf 87.2%
associate-*r*87.2%
Simplified87.2%
Taylor expanded in K around 0 98.6%
Taylor expanded in n around 0 77.4%
+-commutative77.4%
unpow277.4%
distribute-rgt-out88.1%
Simplified88.1%
Taylor expanded in M around inf 96.5%
mul-1-neg96.5%
Simplified96.5%
if -27 < M < 1.7499999999999999e-18Initial program 73.9%
Taylor expanded in n around inf 81.5%
associate-*r*81.5%
Simplified81.5%
Taylor expanded in K around 0 93.3%
Taylor expanded in n around 0 65.2%
+-commutative65.2%
unpow265.2%
distribute-rgt-out67.9%
Simplified67.9%
Taylor expanded in l around inf 35.9%
mul-1-neg35.9%
Simplified35.9%
Final simplification69.3%
(FPCore (K m n M l) :precision binary64 (if (<= l 720.0) (exp (* n (- M (* m 0.5)))) (exp (- l))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= 720.0) {
tmp = exp((n * (M - (m * 0.5))));
} 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 (l <= 720.0d0) then
tmp = exp((n * (m_1 - (m * 0.5d0))))
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 (l <= 720.0) {
tmp = Math.exp((n * (M - (m * 0.5))));
} else {
tmp = Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= 720.0: tmp = math.exp((n * (M - (m * 0.5)))) else: tmp = math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= 720.0) tmp = exp(Float64(n * Float64(M - Float64(m * 0.5)))); else tmp = exp(Float64(-l)); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (l <= 720.0) tmp = exp((n * (M - (m * 0.5)))); else tmp = exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, 720.0], N[Exp[N[(n * N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Exp[(-l)], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 720:\\
\;\;\;\;e^{n \cdot \left(M - m \cdot 0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{-\ell}\\
\end{array}
\end{array}
if l < 720Initial program 75.0%
Taylor expanded in n around inf 83.2%
associate-*r*83.2%
Simplified83.2%
Taylor expanded in K around 0 95.2%
Taylor expanded in n around 0 68.7%
+-commutative68.7%
unpow268.7%
distribute-rgt-out76.6%
Simplified76.6%
Taylor expanded in n around inf 43.1%
if 720 < l Initial program 78.8%
Taylor expanded in n around inf 90.4%
associate-*r*90.4%
Simplified90.4%
Taylor expanded in K around 0 100.0%
Taylor expanded in n around 0 84.7%
+-commutative84.7%
unpow284.7%
distribute-rgt-out88.6%
Simplified88.6%
Taylor expanded in l around inf 100.0%
mul-1-neg100.0%
Simplified100.0%
Final simplification54.6%
(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 75.8%
Taylor expanded in n around inf 84.7%
associate-*r*84.7%
Simplified84.7%
Taylor expanded in K around 0 96.2%
Taylor expanded in n around 0 72.0%
+-commutative72.0%
unpow272.0%
distribute-rgt-out79.0%
Simplified79.0%
Taylor expanded in l around inf 29.4%
mul-1-neg29.4%
Simplified29.4%
Final simplification29.4%
herbie shell --seed 2024039
(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)))))))