
(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 80.9%
Taylor expanded in K around 0 96.8%
cos-neg96.8%
Simplified96.8%
Final simplification96.8%
(FPCore (K m n M l)
:precision binary64
(if (<= m -55.0)
(exp (* -0.25 (pow m 2.0)))
(if (<= m 5.4e-162)
(exp (- (- (fabs (- m n)) l) (pow M 2.0)))
(exp (* -0.25 (pow n 2.0))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -55.0) {
tmp = exp((-0.25 * pow(m, 2.0)));
} else if (m <= 5.4e-162) {
tmp = exp(((fabs((m - n)) - l) - pow(M, 2.0)));
} else {
tmp = exp((-0.25 * pow(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 <= (-55.0d0)) then
tmp = exp(((-0.25d0) * (m ** 2.0d0)))
else if (m <= 5.4d-162) then
tmp = exp(((abs((m - n)) - l) - (m_1 ** 2.0d0)))
else
tmp = exp(((-0.25d0) * (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 <= -55.0) {
tmp = Math.exp((-0.25 * Math.pow(m, 2.0)));
} else if (m <= 5.4e-162) {
tmp = Math.exp(((Math.abs((m - n)) - l) - Math.pow(M, 2.0)));
} else {
tmp = Math.exp((-0.25 * Math.pow(n, 2.0)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -55.0: tmp = math.exp((-0.25 * math.pow(m, 2.0))) elif m <= 5.4e-162: tmp = math.exp(((math.fabs((m - n)) - l) - math.pow(M, 2.0))) else: tmp = math.exp((-0.25 * math.pow(n, 2.0))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -55.0) tmp = exp(Float64(-0.25 * (m ^ 2.0))); elseif (m <= 5.4e-162) tmp = exp(Float64(Float64(abs(Float64(m - n)) - l) - (M ^ 2.0))); else tmp = exp(Float64(-0.25 * (n ^ 2.0))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -55.0) tmp = exp((-0.25 * (m ^ 2.0))); elseif (m <= 5.4e-162) tmp = exp(((abs((m - n)) - l) - (M ^ 2.0))); else tmp = exp((-0.25 * (n ^ 2.0))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -55.0], N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[m, 5.4e-162], N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[Power[M, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -55:\\
\;\;\;\;e^{-0.25 \cdot {m}^{2}}\\
\mathbf{elif}\;m \leq 5.4 \cdot 10^{-162}:\\
\;\;\;\;e^{\left(\left|m - n\right| - \ell\right) - {M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if m < -55Initial program 77.1%
Taylor expanded in n around inf 87.1%
*-commutative87.1%
associate-*l*87.1%
Simplified87.1%
Taylor expanded in K around 0 100.0%
Taylor expanded in m around inf 97.2%
if -55 < m < 5.39999999999999968e-162Initial program 86.3%
Taylor expanded in n around inf 84.2%
*-commutative84.2%
associate-*l*84.2%
Simplified84.2%
Taylor expanded in K around 0 93.6%
Taylor expanded in M around inf 72.6%
if 5.39999999999999968e-162 < m Initial program 77.4%
Taylor expanded in K around 0 95.7%
cos-neg95.7%
Simplified95.7%
Taylor expanded in n around inf 47.9%
Taylor expanded in M around 0 47.8%
Final simplification71.3%
(FPCore (K m n M l) :precision binary64 (exp (- (- (fabs (- m n)) l) (pow (- (/ (+ m n) 2.0) M) 2.0))))
double code(double K, double m, double n, double M, double l) {
return exp(((fabs((m - n)) - l) - pow((((m + n) / 2.0) - M), 2.0)));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = exp(((abs((m - n)) - l) - ((((m + n) / 2.0d0) - m_1) ** 2.0d0)))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.exp(((Math.abs((m - n)) - l) - Math.pow((((m + n) / 2.0) - M), 2.0)));
}
def code(K, m, n, M, l): return math.exp(((math.fabs((m - n)) - l) - math.pow((((m + n) / 2.0) - M), 2.0)))
function code(K, m, n, M, l) return exp(Float64(Float64(abs(Float64(m - n)) - l) - (Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0))) end
function tmp = code(K, m, n, M, l) tmp = exp(((abs((m - n)) - l) - ((((m + n) / 2.0) - M) ^ 2.0))); end
code[K_, m_, n_, M_, l_] := N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{\left(\left|m - n\right| - \ell\right) - {\left(\frac{m + n}{2} - M\right)}^{2}}
\end{array}
Initial program 80.9%
Taylor expanded in n around inf 85.5%
*-commutative85.5%
associate-*l*85.5%
Simplified85.5%
Taylor expanded in K around 0 95.6%
Final simplification95.6%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (exp (- (pow M 2.0)))))
(if (<= m -54.0)
(exp (* -0.25 (pow m 2.0)))
(if (<= m -4.6e-176)
t_0
(if (<= m -1.3e-256)
(/ (cos M) (exp l))
(if (<= m 4.8e-162) t_0 (exp (* -0.25 (pow n 2.0)))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = exp(-pow(M, 2.0));
double tmp;
if (m <= -54.0) {
tmp = exp((-0.25 * pow(m, 2.0)));
} else if (m <= -4.6e-176) {
tmp = t_0;
} else if (m <= -1.3e-256) {
tmp = cos(M) / exp(l);
} else if (m <= 4.8e-162) {
tmp = t_0;
} else {
tmp = exp((-0.25 * pow(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) :: t_0
real(8) :: tmp
t_0 = exp(-(m_1 ** 2.0d0))
if (m <= (-54.0d0)) then
tmp = exp(((-0.25d0) * (m ** 2.0d0)))
else if (m <= (-4.6d-176)) then
tmp = t_0
else if (m <= (-1.3d-256)) then
tmp = cos(m_1) / exp(l)
else if (m <= 4.8d-162) then
tmp = t_0
else
tmp = exp(((-0.25d0) * (n ** 2.0d0)))
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(-Math.pow(M, 2.0));
double tmp;
if (m <= -54.0) {
tmp = Math.exp((-0.25 * Math.pow(m, 2.0)));
} else if (m <= -4.6e-176) {
tmp = t_0;
} else if (m <= -1.3e-256) {
tmp = Math.cos(M) / Math.exp(l);
} else if (m <= 4.8e-162) {
tmp = t_0;
} else {
tmp = Math.exp((-0.25 * Math.pow(n, 2.0)));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.exp(-math.pow(M, 2.0)) tmp = 0 if m <= -54.0: tmp = math.exp((-0.25 * math.pow(m, 2.0))) elif m <= -4.6e-176: tmp = t_0 elif m <= -1.3e-256: tmp = math.cos(M) / math.exp(l) elif m <= 4.8e-162: tmp = t_0 else: tmp = math.exp((-0.25 * math.pow(n, 2.0))) return tmp
function code(K, m, n, M, l) t_0 = exp(Float64(-(M ^ 2.0))) tmp = 0.0 if (m <= -54.0) tmp = exp(Float64(-0.25 * (m ^ 2.0))); elseif (m <= -4.6e-176) tmp = t_0; elseif (m <= -1.3e-256) tmp = Float64(cos(M) / exp(l)); elseif (m <= 4.8e-162) tmp = t_0; else tmp = exp(Float64(-0.25 * (n ^ 2.0))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = exp(-(M ^ 2.0)); tmp = 0.0; if (m <= -54.0) tmp = exp((-0.25 * (m ^ 2.0))); elseif (m <= -4.6e-176) tmp = t_0; elseif (m <= -1.3e-256) tmp = cos(M) / exp(l); elseif (m <= 4.8e-162) tmp = t_0; else tmp = exp((-0.25 * (n ^ 2.0))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]}, If[LessEqual[m, -54.0], N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[m, -4.6e-176], t$95$0, If[LessEqual[m, -1.3e-256], N[(N[Cos[M], $MachinePrecision] / N[Exp[l], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 4.8e-162], t$95$0, N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-{M}^{2}}\\
\mathbf{if}\;m \leq -54:\\
\;\;\;\;e^{-0.25 \cdot {m}^{2}}\\
\mathbf{elif}\;m \leq -4.6 \cdot 10^{-176}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq -1.3 \cdot 10^{-256}:\\
\;\;\;\;\frac{\cos M}{e^{\ell}}\\
\mathbf{elif}\;m \leq 4.8 \cdot 10^{-162}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if m < -54Initial program 77.1%
Taylor expanded in n around inf 87.1%
*-commutative87.1%
associate-*l*87.1%
Simplified87.1%
Taylor expanded in K around 0 100.0%
Taylor expanded in m around inf 97.2%
if -54 < m < -4.6000000000000003e-176 or -1.3e-256 < m < 4.8000000000000004e-162Initial program 86.3%
Taylor expanded in n around inf 83.8%
*-commutative83.8%
associate-*l*83.8%
Simplified83.8%
Taylor expanded in K around 0 92.5%
Taylor expanded in M around inf 64.9%
mul-1-neg64.9%
Simplified64.9%
if -4.6000000000000003e-176 < m < -1.3e-256Initial program 86.7%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in l around inf 60.8%
mul-1-neg60.8%
Simplified60.8%
exp-neg60.8%
un-div-inv60.8%
Applied egg-rr60.8%
if 4.8000000000000004e-162 < m Initial program 77.4%
Taylor expanded in K around 0 95.7%
cos-neg95.7%
Simplified95.7%
Taylor expanded in n around inf 47.9%
Taylor expanded in M around 0 47.8%
Final simplification68.0%
(FPCore (K m n M l) :precision binary64 (if (or (<= n -0.00016) (not (<= n 54.0))) (exp (* -0.25 (pow n 2.0))) (exp (- (pow M 2.0)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((n <= -0.00016) || !(n <= 54.0)) {
tmp = exp((-0.25 * pow(n, 2.0)));
} 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 ((n <= (-0.00016d0)) .or. (.not. (n <= 54.0d0))) then
tmp = exp(((-0.25d0) * (n ** 2.0d0)))
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 ((n <= -0.00016) || !(n <= 54.0)) {
tmp = Math.exp((-0.25 * Math.pow(n, 2.0)));
} else {
tmp = Math.exp(-Math.pow(M, 2.0));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (n <= -0.00016) or not (n <= 54.0): tmp = math.exp((-0.25 * math.pow(n, 2.0))) else: tmp = math.exp(-math.pow(M, 2.0)) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((n <= -0.00016) || !(n <= 54.0)) tmp = exp(Float64(-0.25 * (n ^ 2.0))); else tmp = exp(Float64(-(M ^ 2.0))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((n <= -0.00016) || ~((n <= 54.0))) tmp = exp((-0.25 * (n ^ 2.0))); else tmp = exp(-(M ^ 2.0)); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[n, -0.00016], N[Not[LessEqual[n, 54.0]], $MachinePrecision]], N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -0.00016 \lor \neg \left(n \leq 54\right):\\
\;\;\;\;e^{-0.25 \cdot {n}^{2}}\\
\mathbf{else}:\\
\;\;\;\;e^{-{M}^{2}}\\
\end{array}
\end{array}
if n < -1.60000000000000013e-4 or 54 < n Initial program 77.0%
Taylor expanded in K around 0 99.2%
cos-neg99.2%
Simplified99.2%
Taylor expanded in n around inf 94.4%
Taylor expanded in M around 0 94.4%
if -1.60000000000000013e-4 < n < 54Initial program 84.4%
Taylor expanded in n around inf 91.8%
*-commutative91.8%
associate-*l*91.8%
Simplified91.8%
Taylor expanded in K around 0 93.2%
Taylor expanded in M around inf 62.7%
mul-1-neg62.7%
Simplified62.7%
Final simplification77.8%
(FPCore (K m n M l) :precision binary64 (if (<= l -0.88) (* (cos M) (exp l)) (if (<= l 6.5e-5) (exp (* -0.25 (pow n 2.0))) (exp (- l)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= -0.88) {
tmp = cos(M) * exp(l);
} else if (l <= 6.5e-5) {
tmp = exp((-0.25 * pow(n, 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 (l <= (-0.88d0)) then
tmp = cos(m_1) * exp(l)
else if (l <= 6.5d-5) then
tmp = exp(((-0.25d0) * (n ** 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 (l <= -0.88) {
tmp = Math.cos(M) * Math.exp(l);
} else if (l <= 6.5e-5) {
tmp = Math.exp((-0.25 * Math.pow(n, 2.0)));
} else {
tmp = Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= -0.88: tmp = math.cos(M) * math.exp(l) elif l <= 6.5e-5: tmp = math.exp((-0.25 * math.pow(n, 2.0))) else: tmp = math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= -0.88) tmp = Float64(cos(M) * exp(l)); elseif (l <= 6.5e-5) tmp = exp(Float64(-0.25 * (n ^ 2.0))); else tmp = exp(Float64(-l)); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (l <= -0.88) tmp = cos(M) * exp(l); elseif (l <= 6.5e-5) tmp = exp((-0.25 * (n ^ 2.0))); else tmp = exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, -0.88], N[(N[Cos[M], $MachinePrecision] * N[Exp[l], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.5e-5], N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Exp[(-l)], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.88:\\
\;\;\;\;\cos M \cdot e^{\ell}\\
\mathbf{elif}\;\ell \leq 6.5 \cdot 10^{-5}:\\
\;\;\;\;e^{-0.25 \cdot {n}^{2}}\\
\mathbf{else}:\\
\;\;\;\;e^{-\ell}\\
\end{array}
\end{array}
if l < -0.880000000000000004Initial program 86.8%
Taylor expanded in K around 0 97.1%
cos-neg97.1%
Simplified97.1%
Taylor expanded in l around inf 26.1%
mul-1-neg26.1%
Simplified26.1%
pow126.1%
add-sqr-sqrt26.1%
sqrt-unprod26.1%
sqr-neg26.1%
sqrt-unprod0.0%
add-sqr-sqrt71.1%
Applied egg-rr71.1%
unpow171.1%
Simplified71.1%
if -0.880000000000000004 < l < 6.49999999999999943e-5Initial program 77.0%
Taylor expanded in K around 0 95.3%
cos-neg95.3%
Simplified95.3%
Taylor expanded in n around inf 56.5%
Taylor expanded in M around 0 56.5%
if 6.49999999999999943e-5 < l Initial program 82.8%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in l around inf 98.3%
mul-1-neg98.3%
Simplified98.3%
Taylor expanded in M around 0 98.3%
(FPCore (K m n M l) :precision binary64 (if (<= l -8.8e-7) (* (cos M) (exp l)) (/ (cos M) (exp l))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= -8.8e-7) {
tmp = cos(M) * exp(l);
} 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 <= (-8.8d-7)) then
tmp = cos(m_1) * exp(l)
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 <= -8.8e-7) {
tmp = Math.cos(M) * Math.exp(l);
} else {
tmp = Math.cos(M) / Math.exp(l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= -8.8e-7: tmp = math.cos(M) * math.exp(l) else: tmp = math.cos(M) / math.exp(l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= -8.8e-7) tmp = Float64(cos(M) * exp(l)); 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 <= -8.8e-7) tmp = cos(M) * exp(l); else tmp = cos(M) / exp(l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, -8.8e-7], N[(N[Cos[M], $MachinePrecision] * N[Exp[l], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] / N[Exp[l], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -8.8 \cdot 10^{-7}:\\
\;\;\;\;\cos M \cdot e^{\ell}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos M}{e^{\ell}}\\
\end{array}
\end{array}
if l < -8.8000000000000004e-7Initial program 87.1%
Taylor expanded in K around 0 97.1%
cos-neg97.1%
Simplified97.1%
Taylor expanded in l around inf 25.5%
mul-1-neg25.5%
Simplified25.5%
pow125.5%
add-sqr-sqrt25.5%
sqrt-unprod25.5%
sqr-neg25.5%
sqrt-unprod0.0%
add-sqr-sqrt69.1%
Applied egg-rr69.1%
unpow169.1%
Simplified69.1%
if -8.8000000000000004e-7 < l Initial program 78.6%
Taylor expanded in K around 0 96.7%
cos-neg96.7%
Simplified96.7%
Taylor expanded in l around inf 39.9%
mul-1-neg39.9%
Simplified39.9%
exp-neg39.9%
un-div-inv39.9%
Applied egg-rr39.9%
(FPCore (K m n M l) :precision binary64 (if (<= l 8.2e-8) (* (cos M) (exp l)) (exp (- l))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= 8.2e-8) {
tmp = cos(M) * exp(l);
} 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 <= 8.2d-8) then
tmp = cos(m_1) * exp(l)
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 <= 8.2e-8) {
tmp = Math.cos(M) * Math.exp(l);
} else {
tmp = Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= 8.2e-8: tmp = math.cos(M) * math.exp(l) else: tmp = math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= 8.2e-8) tmp = Float64(cos(M) * exp(l)); else tmp = exp(Float64(-l)); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (l <= 8.2e-8) tmp = cos(M) * exp(l); else tmp = exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, 8.2e-8], N[(N[Cos[M], $MachinePrecision] * N[Exp[l], $MachinePrecision]), $MachinePrecision], N[Exp[(-l)], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 8.2 \cdot 10^{-8}:\\
\;\;\;\;\cos M \cdot e^{\ell}\\
\mathbf{else}:\\
\;\;\;\;e^{-\ell}\\
\end{array}
\end{array}
if l < 8.20000000000000063e-8Initial program 80.4%
Taylor expanded in K around 0 95.9%
cos-neg95.9%
Simplified95.9%
Taylor expanded in l around inf 17.7%
mul-1-neg17.7%
Simplified17.7%
pow117.7%
add-sqr-sqrt12.7%
sqrt-unprod17.7%
sqr-neg17.7%
sqrt-unprod5.0%
add-sqr-sqrt33.1%
Applied egg-rr33.1%
unpow133.1%
Simplified33.1%
if 8.20000000000000063e-8 < l Initial program 82.8%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in l around inf 98.3%
mul-1-neg98.3%
Simplified98.3%
Taylor expanded in M around 0 98.3%
(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 80.9%
Taylor expanded in K around 0 96.8%
cos-neg96.8%
Simplified96.8%
Taylor expanded in l around inf 35.9%
mul-1-neg35.9%
Simplified35.9%
Taylor expanded in M around 0 34.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 80.9%
Taylor expanded in K around 0 96.8%
cos-neg96.8%
Simplified96.8%
Taylor expanded in l around inf 35.9%
mul-1-neg35.9%
Simplified35.9%
Taylor expanded in l around 0 8.2%
herbie shell --seed 2024108
(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)))))))