
(FPCore (K m n M l) :precision binary64 (* (cos (- (/ (* K (+ m n)) 2.0) M)) (exp (- (- (pow (- (/ (+ m n) 2.0) M) 2.0)) (- l (fabs (- m n)))))))
double code(double K, double m, double n, double M, double l) {
return cos((((K * (m + n)) / 2.0) - M)) * exp((-pow((((m + n) / 2.0) - M), 2.0) - (l - fabs((m - n)))));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos((((k * (m + n)) / 2.0d0) - m_1)) * exp((-((((m + n) / 2.0d0) - m_1) ** 2.0d0) - (l - abs((m - n)))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos((((K * (m + n)) / 2.0) - M)) * Math.exp((-Math.pow((((m + n) / 2.0) - M), 2.0) - (l - Math.abs((m - n)))));
}
def code(K, m, n, M, l): return math.cos((((K * (m + n)) / 2.0) - M)) * math.exp((-math.pow((((m + n) / 2.0) - M), 2.0) - (l - math.fabs((m - n)))))
function code(K, m, n, M, l) return Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * exp(Float64(Float64(-(Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)) - Float64(l - abs(Float64(m - n)))))) end
function tmp = code(K, m, n, M, l) tmp = cos((((K * (m + n)) / 2.0) - M)) * exp((-((((m + n) / 2.0) - M) ^ 2.0) - (l - abs((m - n))))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[((-N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]) - N[(l - N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (K m n M l) :precision binary64 (* (cos (- (/ (* K (+ m n)) 2.0) M)) (exp (- (- (pow (- (/ (+ m n) 2.0) M) 2.0)) (- l (fabs (- m n)))))))
double code(double K, double m, double n, double M, double l) {
return cos((((K * (m + n)) / 2.0) - M)) * exp((-pow((((m + n) / 2.0) - M), 2.0) - (l - fabs((m - n)))));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos((((k * (m + n)) / 2.0d0) - m_1)) * exp((-((((m + n) / 2.0d0) - m_1) ** 2.0d0) - (l - abs((m - n)))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos((((K * (m + n)) / 2.0) - M)) * Math.exp((-Math.pow((((m + n) / 2.0) - M), 2.0) - (l - Math.abs((m - n)))));
}
def code(K, m, n, M, l): return math.cos((((K * (m + n)) / 2.0) - M)) * math.exp((-math.pow((((m + n) / 2.0) - M), 2.0) - (l - math.fabs((m - n)))))
function code(K, m, n, M, l) return Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * exp(Float64(Float64(-(Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)) - Float64(l - abs(Float64(m - n)))))) end
function tmp = code(K, m, n, M, l) tmp = cos((((K * (m + n)) / 2.0) - M)) * exp((-((((m + n) / 2.0) - M) ^ 2.0) - (l - abs((m - n))))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[((-N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]) - N[(l - N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}
\end{array}
(FPCore (K m n M l) :precision binary64 (* (cos M) (exp (- (- (fabs (- m n)) l) (pow (- (/ (+ m n) 2.0) M) 2.0)))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp(((fabs((m - n)) - l) - pow((((m + n) / 2.0) - M), 2.0)));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos(m_1) * exp(((abs((m - n)) - l) - ((((m + n) / 2.0d0) - m_1) ** 2.0d0)))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.exp(((Math.abs((m - n)) - l) - Math.pow((((m + n) / 2.0) - M), 2.0)));
}
def code(K, m, n, M, l): return math.cos(M) * math.exp(((math.fabs((m - n)) - l) - math.pow((((m + n) / 2.0) - M), 2.0)))
function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(Float64(abs(Float64(m - n)) - l) - (Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * exp(((abs((m - n)) - l) - ((((m + n) / 2.0) - M) ^ 2.0))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{\left(\left|m - n\right| - \ell\right) - {\left(\frac{m + n}{2} - M\right)}^{2}}
\end{array}
Initial program 74.4%
*-commutative74.4%
associate-*r/74.4%
associate--r-74.4%
+-commutative74.4%
associate-+r-74.4%
unsub-neg74.4%
associate--r+74.4%
+-commutative74.4%
associate--r+74.4%
Simplified74.4%
Taylor expanded in K around 0 95.9%
cos-neg95.9%
Simplified95.9%
Final simplification95.9%
(FPCore (K m n M l)
:precision binary64
(if (<= m -5.6)
(exp (* (* m m) -0.25))
(if (<= m -6.1e-173)
(*
(cos (- (/ K (/ 2.0 (+ m n))) M))
(exp (- (fabs (- m n)) (+ l (* M M)))))
(* (cos M) (exp (* -0.25 (* n n)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -5.6) {
tmp = exp(((m * m) * -0.25));
} else if (m <= -6.1e-173) {
tmp = cos(((K / (2.0 / (m + n))) - M)) * exp((fabs((m - n)) - (l + (M * M))));
} 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 <= (-5.6d0)) then
tmp = exp(((m * m) * (-0.25d0)))
else if (m <= (-6.1d-173)) then
tmp = cos(((k / (2.0d0 / (m + n))) - m_1)) * exp((abs((m - n)) - (l + (m_1 * m_1))))
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 <= -5.6) {
tmp = Math.exp(((m * m) * -0.25));
} else if (m <= -6.1e-173) {
tmp = Math.cos(((K / (2.0 / (m + n))) - M)) * Math.exp((Math.abs((m - n)) - (l + (M * M))));
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * (n * n)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -5.6: tmp = math.exp(((m * m) * -0.25)) elif m <= -6.1e-173: tmp = math.cos(((K / (2.0 / (m + n))) - M)) * math.exp((math.fabs((m - n)) - (l + (M * M)))) 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 <= -5.6) tmp = exp(Float64(Float64(m * m) * -0.25)); elseif (m <= -6.1e-173) tmp = Float64(cos(Float64(Float64(K / Float64(2.0 / Float64(m + n))) - M)) * exp(Float64(abs(Float64(m - n)) - Float64(l + Float64(M * M))))); 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 <= -5.6) tmp = exp(((m * m) * -0.25)); elseif (m <= -6.1e-173) tmp = cos(((K / (2.0 / (m + n))) - M)) * exp((abs((m - n)) - (l + (M * M)))); else tmp = cos(M) * exp((-0.25 * (n * n))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -5.6], N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision], If[LessEqual[m, -6.1e-173], N[(N[Cos[N[(N[(K / N[(2.0 / N[(m + n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - N[(l + N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $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 -5.6:\\
\;\;\;\;e^{\left(m \cdot m\right) \cdot -0.25}\\
\mathbf{elif}\;m \leq -6.1 \cdot 10^{-173}:\\
\;\;\;\;\cos \left(\frac{K}{\frac{2}{m + n}} - M\right) \cdot e^{\left|m - n\right| - \left(\ell + M \cdot M\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(n \cdot n\right)}\\
\end{array}
\end{array}
if m < -5.5999999999999996Initial program 64.2%
*-commutative64.2%
associate-*r/64.2%
associate--r-64.2%
+-commutative64.2%
associate-+r-64.2%
unsub-neg64.2%
associate--r+64.2%
+-commutative64.2%
associate--r+64.2%
Simplified64.2%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in m around inf 97.1%
*-commutative97.1%
unpow297.1%
Simplified97.1%
Taylor expanded in M around 0 97.1%
if -5.5999999999999996 < m < -6.0999999999999998e-173Initial program 82.3%
associate-/l*82.9%
associate--r-82.9%
Simplified82.9%
Taylor expanded in M around inf 68.9%
unpow268.9%
Simplified68.9%
if -6.0999999999999998e-173 < m Initial program 77.3%
*-commutative77.3%
associate-*r/77.3%
associate--r-77.3%
+-commutative77.3%
associate-+r-77.3%
unsub-neg77.3%
associate--r+77.3%
+-commutative77.3%
associate--r+77.3%
Simplified77.3%
Taylor expanded in K around 0 94.8%
cos-neg94.8%
Simplified94.8%
Taylor expanded in n around inf 62.4%
*-commutative62.4%
unpow262.4%
Simplified62.4%
Final simplification72.2%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (exp (* (* m m) -0.25))))
(if (<= m -5.6)
t_0
(if (<= m -2.5e-128)
(* (cos M) (exp (- l)))
(if (<= m 54.0) (* (cos M) (exp (* M (- M)))) t_0)))))
double code(double K, double m, double n, double M, double l) {
double t_0 = exp(((m * m) * -0.25));
double tmp;
if (m <= -5.6) {
tmp = t_0;
} else if (m <= -2.5e-128) {
tmp = cos(M) * exp(-l);
} else if (m <= 54.0) {
tmp = cos(M) * exp((M * -M));
} else {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = exp(((m * m) * (-0.25d0)))
if (m <= (-5.6d0)) then
tmp = t_0
else if (m <= (-2.5d-128)) then
tmp = cos(m_1) * exp(-l)
else if (m <= 54.0d0) then
tmp = cos(m_1) * exp((m_1 * -m_1))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.exp(((m * m) * -0.25));
double tmp;
if (m <= -5.6) {
tmp = t_0;
} else if (m <= -2.5e-128) {
tmp = Math.cos(M) * Math.exp(-l);
} else if (m <= 54.0) {
tmp = Math.cos(M) * Math.exp((M * -M));
} else {
tmp = t_0;
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.exp(((m * m) * -0.25)) tmp = 0 if m <= -5.6: tmp = t_0 elif m <= -2.5e-128: tmp = math.cos(M) * math.exp(-l) elif m <= 54.0: tmp = math.cos(M) * math.exp((M * -M)) else: tmp = t_0 return tmp
function code(K, m, n, M, l) t_0 = exp(Float64(Float64(m * m) * -0.25)) tmp = 0.0 if (m <= -5.6) tmp = t_0; elseif (m <= -2.5e-128) tmp = Float64(cos(M) * exp(Float64(-l))); elseif (m <= 54.0) tmp = Float64(cos(M) * exp(Float64(M * Float64(-M)))); else tmp = t_0; end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = exp(((m * m) * -0.25)); tmp = 0.0; if (m <= -5.6) tmp = t_0; elseif (m <= -2.5e-128) tmp = cos(M) * exp(-l); elseif (m <= 54.0) tmp = cos(M) * exp((M * -M)); else tmp = t_0; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[m, -5.6], t$95$0, If[LessEqual[m, -2.5e-128], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 54.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * (-M)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\left(m \cdot m\right) \cdot -0.25}\\
\mathbf{if}\;m \leq -5.6:\\
\;\;\;\;t_0\\
\mathbf{elif}\;m \leq -2.5 \cdot 10^{-128}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\mathbf{elif}\;m \leq 54:\\
\;\;\;\;\cos M \cdot e^{M \cdot \left(-M\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if m < -5.5999999999999996 or 54 < m Initial program 67.1%
*-commutative67.1%
associate-*r/67.1%
associate--r-67.1%
+-commutative67.1%
associate-+r-67.1%
unsub-neg67.1%
associate--r+67.1%
+-commutative67.1%
associate--r+67.1%
Simplified67.1%
Taylor expanded in K around 0 99.3%
cos-neg99.3%
Simplified99.3%
Taylor expanded in m around inf 97.9%
*-commutative97.9%
unpow297.9%
Simplified97.9%
Taylor expanded in M around 0 97.9%
if -5.5999999999999996 < m < -2.5000000000000001e-128Initial program 85.7%
*-commutative85.7%
associate-*r/85.7%
associate--r-85.7%
+-commutative85.7%
associate-+r-85.7%
unsub-neg85.7%
associate--r+85.7%
+-commutative85.7%
associate--r+85.7%
Simplified85.7%
Taylor expanded in l around inf 62.5%
neg-mul-162.5%
Simplified62.5%
Taylor expanded in K around 0 72.1%
cos-neg72.1%
Simplified72.1%
if -2.5000000000000001e-128 < m < 54Initial program 82.6%
*-commutative82.6%
associate-*r/82.6%
associate--r-82.6%
+-commutative82.6%
associate-+r-82.6%
unsub-neg82.6%
associate--r+82.6%
+-commutative82.6%
associate--r+82.6%
Simplified82.6%
Taylor expanded in K around 0 89.9%
cos-neg89.9%
Simplified89.9%
Taylor expanded in M around inf 53.2%
mul-1-neg53.2%
unpow253.2%
distribute-rgt-neg-in53.2%
Simplified53.2%
Final simplification79.2%
(FPCore (K m n M l)
:precision binary64
(if (<= m -5.6)
(exp (* (* m m) -0.25))
(if (<= m -1.35e-126)
(* (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 <= -5.6) {
tmp = exp(((m * m) * -0.25));
} else if (m <= -1.35e-126) {
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 <= (-5.6d0)) then
tmp = exp(((m * m) * (-0.25d0)))
else if (m <= (-1.35d-126)) 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 <= -5.6) {
tmp = Math.exp(((m * m) * -0.25));
} else if (m <= -1.35e-126) {
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 <= -5.6: tmp = math.exp(((m * m) * -0.25)) elif m <= -1.35e-126: 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 <= -5.6) tmp = exp(Float64(Float64(m * m) * -0.25)); elseif (m <= -1.35e-126) 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 <= -5.6) tmp = exp(((m * m) * -0.25)); elseif (m <= -1.35e-126) 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, -5.6], N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision], If[LessEqual[m, -1.35e-126], 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 -5.6:\\
\;\;\;\;e^{\left(m \cdot m\right) \cdot -0.25}\\
\mathbf{elif}\;m \leq -1.35 \cdot 10^{-126}:\\
\;\;\;\;\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 < -5.5999999999999996Initial program 64.2%
*-commutative64.2%
associate-*r/64.2%
associate--r-64.2%
+-commutative64.2%
associate-+r-64.2%
unsub-neg64.2%
associate--r+64.2%
+-commutative64.2%
associate--r+64.2%
Simplified64.2%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in m around inf 97.1%
*-commutative97.1%
unpow297.1%
Simplified97.1%
Taylor expanded in M around 0 97.1%
if -5.5999999999999996 < m < -1.34999999999999998e-126Initial program 85.0%
*-commutative85.0%
associate-*r/85.0%
associate--r-85.0%
+-commutative85.0%
associate-+r-85.0%
unsub-neg85.0%
associate--r+85.0%
+-commutative85.0%
associate--r+85.0%
Simplified85.0%
Taylor expanded in l around inf 60.6%
neg-mul-160.6%
Simplified60.6%
Taylor expanded in K around 0 70.7%
cos-neg70.7%
Simplified70.7%
if -1.34999999999999998e-126 < m Initial program 77.2%
*-commutative77.2%
associate-*r/77.2%
associate--r-77.2%
+-commutative77.2%
associate-+r-77.2%
unsub-neg77.2%
associate--r+77.2%
+-commutative77.2%
associate--r+77.2%
Simplified77.2%
Taylor expanded in K around 0 93.7%
cos-neg93.7%
Simplified93.7%
Taylor expanded in n around inf 62.2%
*-commutative62.2%
unpow262.2%
Simplified62.2%
Final simplification72.0%
(FPCore (K m n M l) :precision binary64 (if (<= l 1.45e-6) (exp (* (* m m) -0.25)) (/ (cos M) (exp l))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= 1.45e-6) {
tmp = exp(((m * m) * -0.25));
} else {
tmp = cos(M) / exp(l);
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (l <= 1.45d-6) then
tmp = exp(((m * m) * (-0.25d0)))
else
tmp = cos(m_1) / exp(l)
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= 1.45e-6) {
tmp = Math.exp(((m * m) * -0.25));
} else {
tmp = Math.cos(M) / Math.exp(l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= 1.45e-6: tmp = math.exp(((m * m) * -0.25)) else: tmp = math.cos(M) / math.exp(l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= 1.45e-6) tmp = exp(Float64(Float64(m * m) * -0.25)); else tmp = Float64(cos(M) / exp(l)); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (l <= 1.45e-6) tmp = exp(((m * m) * -0.25)); else tmp = cos(M) / exp(l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, 1.45e-6], N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision], N[(N[Cos[M], $MachinePrecision] / N[Exp[l], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.45 \cdot 10^{-6}:\\
\;\;\;\;e^{\left(m \cdot m\right) \cdot -0.25}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos M}{e^{\ell}}\\
\end{array}
\end{array}
if l < 1.4500000000000001e-6Initial program 72.7%
*-commutative72.7%
associate-*r/72.7%
associate--r-72.7%
+-commutative72.7%
associate-+r-72.7%
unsub-neg72.7%
associate--r+72.7%
+-commutative72.7%
associate--r+72.7%
Simplified72.7%
Taylor expanded in K around 0 94.0%
cos-neg94.0%
Simplified94.0%
Taylor expanded in m around inf 61.9%
*-commutative61.9%
unpow261.9%
Simplified61.9%
Taylor expanded in M around 0 61.9%
if 1.4500000000000001e-6 < l Initial program 78.2%
*-commutative78.2%
associate-*r/78.2%
associate--r-78.2%
+-commutative78.2%
associate-+r-78.2%
unsub-neg78.2%
associate--r+78.2%
+-commutative78.2%
associate--r+78.2%
Simplified78.2%
Taylor expanded in l around inf 77.0%
neg-mul-177.0%
Simplified77.0%
Taylor expanded in K around 0 98.8%
exp-neg98.8%
associate-*l/98.8%
*-lft-identity98.8%
cos-neg98.8%
Simplified98.8%
Final simplification73.1%
(FPCore (K m n M l) :precision binary64 (if (<= l 1.45e-6) (exp (* (* m m) -0.25)) (exp (- l))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= 1.45e-6) {
tmp = exp(((m * m) * -0.25));
} 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 <= 1.45d-6) then
tmp = exp(((m * m) * (-0.25d0)))
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 <= 1.45e-6) {
tmp = Math.exp(((m * m) * -0.25));
} else {
tmp = Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= 1.45e-6: tmp = math.exp(((m * m) * -0.25)) else: tmp = math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= 1.45e-6) tmp = exp(Float64(Float64(m * m) * -0.25)); else tmp = exp(Float64(-l)); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (l <= 1.45e-6) tmp = exp(((m * m) * -0.25)); else tmp = exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, 1.45e-6], N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision], N[Exp[(-l)], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.45 \cdot 10^{-6}:\\
\;\;\;\;e^{\left(m \cdot m\right) \cdot -0.25}\\
\mathbf{else}:\\
\;\;\;\;e^{-\ell}\\
\end{array}
\end{array}
if l < 1.4500000000000001e-6Initial program 72.7%
*-commutative72.7%
associate-*r/72.7%
associate--r-72.7%
+-commutative72.7%
associate-+r-72.7%
unsub-neg72.7%
associate--r+72.7%
+-commutative72.7%
associate--r+72.7%
Simplified72.7%
Taylor expanded in K around 0 94.0%
cos-neg94.0%
Simplified94.0%
Taylor expanded in m around inf 61.9%
*-commutative61.9%
unpow261.9%
Simplified61.9%
Taylor expanded in M around 0 61.9%
if 1.4500000000000001e-6 < l Initial program 78.2%
*-commutative78.2%
associate-*r/78.2%
associate--r-78.2%
+-commutative78.2%
associate-+r-78.2%
unsub-neg78.2%
associate--r+78.2%
+-commutative78.2%
associate--r+78.2%
Simplified78.2%
Taylor expanded in l around inf 77.0%
neg-mul-177.0%
Simplified77.0%
Taylor expanded in K around 0 98.8%
exp-neg98.8%
associate-*l/98.8%
*-lft-identity98.8%
cos-neg98.8%
Simplified98.8%
Taylor expanded in M around 0 98.8%
rec-exp98.8%
Simplified98.8%
Final simplification73.1%
(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%
*-commutative74.4%
associate-*r/74.4%
associate--r-74.4%
+-commutative74.4%
associate-+r-74.4%
unsub-neg74.4%
associate--r+74.4%
+-commutative74.4%
associate--r+74.4%
Simplified74.4%
Taylor expanded in l around inf 29.2%
neg-mul-129.2%
Simplified29.2%
Taylor expanded in K around 0 36.2%
exp-neg36.2%
associate-*l/36.2%
*-lft-identity36.2%
cos-neg36.2%
Simplified36.2%
Taylor expanded in M around 0 35.8%
rec-exp35.8%
Simplified35.8%
Final simplification35.8%
(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 74.4%
*-commutative74.4%
associate-*r/74.4%
associate--r-74.4%
+-commutative74.4%
associate-+r-74.4%
unsub-neg74.4%
associate--r+74.4%
+-commutative74.4%
associate--r+74.4%
Simplified74.4%
Taylor expanded in l around inf 29.2%
neg-mul-129.2%
Simplified29.2%
Taylor expanded in l around 0 5.9%
Taylor expanded in K around 0 6.2%
neg-mul-16.2%
Simplified6.2%
Taylor expanded in M around -inf 6.2%
neg-mul-16.2%
cos-neg6.2%
Simplified6.2%
Final simplification6.2%
(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 74.4%
*-commutative74.4%
associate-*r/74.4%
associate--r-74.4%
+-commutative74.4%
associate-+r-74.4%
unsub-neg74.4%
associate--r+74.4%
+-commutative74.4%
associate--r+74.4%
Simplified74.4%
Taylor expanded in l around inf 29.2%
neg-mul-129.2%
Simplified29.2%
Taylor expanded in l around 0 5.9%
Taylor expanded in K around 0 6.2%
neg-mul-16.2%
Simplified6.2%
Taylor expanded in M around 0 6.2%
Final simplification6.2%
herbie shell --seed 2023238
(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)))))))