
(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 76.7%
Taylor expanded in K around 0 96.9%
cos-neg96.9%
Simplified96.9%
Final simplification96.9%
(FPCore (K m n M l) :precision binary64 (if (or (<= M -2.9e+28) (not (<= M 30.0))) (* (cos M) (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 <= -2.9e+28) || !(M <= 30.0)) {
tmp = cos(M) * 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 <= (-2.9d+28)) .or. (.not. (m_1 <= 30.0d0))) then
tmp = cos(m_1) * 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 <= -2.9e+28) || !(M <= 30.0)) {
tmp = Math.cos(M) * 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 <= -2.9e+28) or not (M <= 30.0): tmp = math.cos(M) * 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 <= -2.9e+28) || !(M <= 30.0)) tmp = Float64(cos(M) * 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 <= -2.9e+28) || ~((M <= 30.0))) tmp = cos(M) * 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, -2.9e+28], N[Not[LessEqual[M, 30.0]], $MachinePrecision]], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $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 -2.9 \cdot 10^{+28} \lor \neg \left(M \leq 30\right):\\
\;\;\;\;\cos M \cdot 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 < -2.9000000000000001e28 or 30 < M Initial program 76.4%
Taylor expanded in K around 0 98.4%
cos-neg98.4%
Simplified98.4%
Taylor expanded in M around inf 97.6%
mul-1-neg97.6%
Simplified97.6%
if -2.9000000000000001e28 < M < 30Initial program 76.9%
Taylor expanded in K around 0 95.5%
cos-neg95.5%
Simplified95.5%
Taylor expanded in M around 0 95.5%
associate--r+95.5%
Simplified95.5%
Final simplification96.5%
(FPCore (K m n M l) :precision binary64 (if (or (<= M -1.75e+28) (not (<= M 27.0))) (* (cos M) (exp (- (pow M 2.0)))) (exp (- (- l) (* 0.25 (pow (+ m n) 2.0))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((M <= -1.75e+28) || !(M <= 27.0)) {
tmp = cos(M) * exp(-pow(M, 2.0));
} else {
tmp = exp((-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 <= (-1.75d+28)) .or. (.not. (m_1 <= 27.0d0))) then
tmp = cos(m_1) * exp(-(m_1 ** 2.0d0))
else
tmp = exp((-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 <= -1.75e+28) || !(M <= 27.0)) {
tmp = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
} else {
tmp = Math.exp((-l - (0.25 * Math.pow((m + n), 2.0))));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (M <= -1.75e+28) or not (M <= 27.0): tmp = math.cos(M) * math.exp(-math.pow(M, 2.0)) else: tmp = math.exp((-l - (0.25 * math.pow((m + n), 2.0)))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((M <= -1.75e+28) || !(M <= 27.0)) tmp = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))); else tmp = exp(Float64(Float64(-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 <= -1.75e+28) || ~((M <= 27.0))) tmp = cos(M) * exp(-(M ^ 2.0)); else tmp = exp((-l - (0.25 * ((m + n) ^ 2.0)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[M, -1.75e+28], N[Not[LessEqual[M, 27.0]], $MachinePrecision]], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision], N[Exp[N[((-l) - 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 -1.75 \cdot 10^{+28} \lor \neg \left(M \leq 27\right):\\
\;\;\;\;\cos M \cdot e^{-{M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(-\ell\right) - 0.25 \cdot {\left(m + n\right)}^{2}}\\
\end{array}
\end{array}
if M < -1.75e28 or 27 < M Initial program 76.4%
Taylor expanded in K around 0 98.4%
cos-neg98.4%
Simplified98.4%
Taylor expanded in M around inf 97.6%
mul-1-neg97.6%
Simplified97.6%
if -1.75e28 < M < 27Initial program 76.9%
Taylor expanded in K around 0 95.5%
cos-neg95.5%
Simplified95.5%
add-sqr-sqrt95.5%
pow295.5%
associate--r-95.5%
div-inv95.5%
metadata-eval95.5%
fabs-sub95.5%
Applied egg-rr95.5%
Taylor expanded in M around 0 95.5%
associate--r+95.5%
+-commutative95.5%
Simplified95.5%
Taylor expanded in l around inf 94.6%
neg-mul-194.6%
Simplified94.6%
Final simplification96.0%
(FPCore (K m n M l)
:precision binary64
(if (<= m -4100.0)
(exp (* (pow m 2.0) -0.25))
(if (<= m -2.4e-34)
(* (cos M) (exp (- l)))
(* (cos M) (exp (* -0.25 (* n n)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -4100.0) {
tmp = exp((pow(m, 2.0) * -0.25));
} else if (m <= -2.4e-34) {
tmp = cos(M) * exp(-l);
} else {
tmp = cos(M) * exp((-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 <= (-4100.0d0)) then
tmp = exp(((m ** 2.0d0) * (-0.25d0)))
else if (m <= (-2.4d-34)) then
tmp = cos(m_1) * exp(-l)
else
tmp = cos(m_1) * exp(((-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 <= -4100.0) {
tmp = Math.exp((Math.pow(m, 2.0) * -0.25));
} else if (m <= -2.4e-34) {
tmp = Math.cos(M) * Math.exp(-l);
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * (n * n)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -4100.0: tmp = math.exp((math.pow(m, 2.0) * -0.25)) elif m <= -2.4e-34: tmp = math.cos(M) * math.exp(-l) else: tmp = math.cos(M) * math.exp((-0.25 * (n * n))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -4100.0) tmp = exp(Float64((m ^ 2.0) * -0.25)); elseif (m <= -2.4e-34) tmp = Float64(cos(M) * exp(Float64(-l))); else tmp = Float64(cos(M) * exp(Float64(-0.25 * Float64(n * n)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -4100.0) tmp = exp(((m ^ 2.0) * -0.25)); elseif (m <= -2.4e-34) tmp = cos(M) * exp(-l); else tmp = cos(M) * exp((-0.25 * (n * n))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -4100.0], N[Exp[N[(N[Power[m, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision], If[LessEqual[m, -2.4e-34], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -4100:\\
\;\;\;\;e^{{m}^{2} \cdot -0.25}\\
\mathbf{elif}\;m \leq -2.4 \cdot 10^{-34}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(n \cdot n\right)}\\
\end{array}
\end{array}
if m < -4100Initial program 68.8%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
add-sqr-sqrt100.0%
pow2100.0%
associate--r-100.0%
div-inv100.0%
metadata-eval100.0%
fabs-sub100.0%
Applied egg-rr100.0%
Taylor expanded in M around 0 100.0%
associate--r+100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around inf 96.9%
*-commutative96.9%
Simplified96.9%
if -4100 < m < -2.39999999999999991e-34Initial program 88.9%
Taylor expanded in l around inf 74.6%
mul-1-neg74.6%
Simplified74.6%
Taylor expanded in K around 0 63.9%
cos-neg63.9%
Simplified63.9%
if -2.39999999999999991e-34 < m Initial program 78.9%
Taylor expanded in K around 0 96.2%
cos-neg96.2%
Simplified96.2%
Taylor expanded in n around inf 54.9%
unpow254.9%
Applied egg-rr54.9%
(FPCore (K m n M l) :precision binary64 (if (<= m -4100.0) (exp (* (pow m 2.0) -0.25)) (if (<= m -3.3e-38) (* (cos M) (exp (- l))) (exp (* -0.25 (* n n))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -4100.0) {
tmp = exp((pow(m, 2.0) * -0.25));
} else if (m <= -3.3e-38) {
tmp = cos(M) * exp(-l);
} else {
tmp = exp((-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 <= (-4100.0d0)) then
tmp = exp(((m ** 2.0d0) * (-0.25d0)))
else if (m <= (-3.3d-38)) then
tmp = cos(m_1) * exp(-l)
else
tmp = exp(((-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 <= -4100.0) {
tmp = Math.exp((Math.pow(m, 2.0) * -0.25));
} else if (m <= -3.3e-38) {
tmp = Math.cos(M) * Math.exp(-l);
} else {
tmp = Math.exp((-0.25 * (n * n)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -4100.0: tmp = math.exp((math.pow(m, 2.0) * -0.25)) elif m <= -3.3e-38: tmp = math.cos(M) * math.exp(-l) else: tmp = math.exp((-0.25 * (n * n))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -4100.0) tmp = exp(Float64((m ^ 2.0) * -0.25)); elseif (m <= -3.3e-38) tmp = Float64(cos(M) * exp(Float64(-l))); else tmp = exp(Float64(-0.25 * Float64(n * n))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -4100.0) tmp = exp(((m ^ 2.0) * -0.25)); elseif (m <= -3.3e-38) tmp = cos(M) * exp(-l); else tmp = exp((-0.25 * (n * n))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -4100.0], N[Exp[N[(N[Power[m, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision], If[LessEqual[m, -3.3e-38], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -4100:\\
\;\;\;\;e^{{m}^{2} \cdot -0.25}\\
\mathbf{elif}\;m \leq -3.3 \cdot 10^{-38}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\mathbf{else}:\\
\;\;\;\;e^{-0.25 \cdot \left(n \cdot n\right)}\\
\end{array}
\end{array}
if m < -4100Initial program 68.8%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
add-sqr-sqrt100.0%
pow2100.0%
associate--r-100.0%
div-inv100.0%
metadata-eval100.0%
fabs-sub100.0%
Applied egg-rr100.0%
Taylor expanded in M around 0 100.0%
associate--r+100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around inf 96.9%
*-commutative96.9%
Simplified96.9%
if -4100 < m < -3.3000000000000002e-38Initial program 90.9%
Taylor expanded in l around inf 61.6%
mul-1-neg61.6%
Simplified61.6%
Taylor expanded in K around 0 52.8%
cos-neg52.8%
Simplified52.8%
if -3.3000000000000002e-38 < m Initial program 78.6%
Taylor expanded in K around 0 96.1%
cos-neg96.1%
Simplified96.1%
Taylor expanded in n around inf 55.5%
unpow255.5%
Applied egg-rr55.5%
Taylor expanded in M around 0 55.5%
Final simplification65.7%
(FPCore (K m n M l) :precision binary64 (if (<= m -4100.0) (exp (* (pow m 2.0) -0.25)) (exp (* -0.25 (* n n)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -4100.0) {
tmp = exp((pow(m, 2.0) * -0.25));
} else {
tmp = exp((-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 <= (-4100.0d0)) then
tmp = exp(((m ** 2.0d0) * (-0.25d0)))
else
tmp = exp(((-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 <= -4100.0) {
tmp = Math.exp((Math.pow(m, 2.0) * -0.25));
} else {
tmp = Math.exp((-0.25 * (n * n)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -4100.0: tmp = math.exp((math.pow(m, 2.0) * -0.25)) else: tmp = math.exp((-0.25 * (n * n))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -4100.0) tmp = exp(Float64((m ^ 2.0) * -0.25)); else tmp = exp(Float64(-0.25 * Float64(n * n))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -4100.0) tmp = exp(((m ^ 2.0) * -0.25)); else tmp = exp((-0.25 * (n * n))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -4100.0], N[Exp[N[(N[Power[m, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision], N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -4100:\\
\;\;\;\;e^{{m}^{2} \cdot -0.25}\\
\mathbf{else}:\\
\;\;\;\;e^{-0.25 \cdot \left(n \cdot n\right)}\\
\end{array}
\end{array}
if m < -4100Initial program 68.8%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
add-sqr-sqrt100.0%
pow2100.0%
associate--r-100.0%
div-inv100.0%
metadata-eval100.0%
fabs-sub100.0%
Applied egg-rr100.0%
Taylor expanded in M around 0 100.0%
associate--r+100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around inf 96.9%
*-commutative96.9%
Simplified96.9%
if -4100 < m Initial program 79.3%
Taylor expanded in K around 0 95.8%
cos-neg95.8%
Simplified95.8%
Taylor expanded in n around inf 53.3%
unpow253.3%
Applied egg-rr53.3%
Taylor expanded in M around 0 53.3%
Final simplification64.2%
(FPCore (K m n M l) :precision binary64 (exp (- (- l) (* 0.25 (pow (+ m n) 2.0)))))
double code(double K, double m, double n, double M, double l) {
return exp((-l - (0.25 * pow((m + n), 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((-l - (0.25d0 * ((m + n) ** 2.0d0))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.exp((-l - (0.25 * Math.pow((m + n), 2.0))));
}
def code(K, m, n, M, l): return math.exp((-l - (0.25 * math.pow((m + n), 2.0))))
function code(K, m, n, M, l) return exp(Float64(Float64(-l) - Float64(0.25 * (Float64(m + n) ^ 2.0)))) end
function tmp = code(K, m, n, M, l) tmp = exp((-l - (0.25 * ((m + n) ^ 2.0)))); end
code[K_, m_, n_, M_, l_] := N[Exp[N[((-l) - N[(0.25 * N[Power[N[(m + n), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{\left(-\ell\right) - 0.25 \cdot {\left(m + n\right)}^{2}}
\end{array}
Initial program 76.7%
Taylor expanded in K around 0 96.9%
cos-neg96.9%
Simplified96.9%
add-sqr-sqrt96.5%
pow296.5%
associate--r-96.5%
div-inv96.5%
metadata-eval96.5%
fabs-sub96.5%
Applied egg-rr96.5%
Taylor expanded in M around 0 88.9%
associate--r+88.9%
+-commutative88.9%
Simplified88.9%
Taylor expanded in l around inf 88.4%
neg-mul-188.4%
Simplified88.4%
Final simplification88.4%
(FPCore (K m n M l) :precision binary64 (exp (* -0.25 (* n n))))
double code(double K, double m, double n, double M, double l) {
return exp((-0.25 * (n * 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 = exp(((-0.25d0) * (n * n)))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.exp((-0.25 * (n * n)));
}
def code(K, m, n, M, l): return math.exp((-0.25 * (n * n)))
function code(K, m, n, M, l) return exp(Float64(-0.25 * Float64(n * n))) end
function tmp = code(K, m, n, M, l) tmp = exp((-0.25 * (n * n))); end
code[K_, m_, n_, M_, l_] := N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{-0.25 \cdot \left(n \cdot n\right)}
\end{array}
Initial program 76.7%
Taylor expanded in K around 0 96.9%
cos-neg96.9%
Simplified96.9%
Taylor expanded in n around inf 53.2%
unpow253.2%
Applied egg-rr53.2%
Taylor expanded in M around 0 53.2%
Final simplification53.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 76.7%
Taylor expanded in l around inf 32.9%
mul-1-neg32.9%
Simplified32.9%
Taylor expanded in l around 0 8.5%
Taylor expanded in K around 0 9.0%
cos-neg9.0%
Simplified9.0%
(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 76.7%
Taylor expanded in K around 0 96.9%
cos-neg96.9%
Simplified96.9%
Taylor expanded in n around inf 53.2%
Taylor expanded in M around 0 53.2%
exp-prod53.2%
Simplified53.2%
Taylor expanded in n around 0 9.0%
herbie shell --seed 2024166
(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)))))))