
(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 (- n m)) (+ (pow (fma 0.5 (+ n m) (- M)) 2.0) l)))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp((fabs((n - m)) - (pow(fma(0.5, (n + m), -M), 2.0) + l)));
}
function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(abs(Float64(n - m)) - Float64((fma(0.5, Float64(n + m), Float64(-M)) ^ 2.0) + l)))) end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - N[(N[Power[N[(0.5 * N[(n + m), $MachinePrecision] + (-M)), $MachinePrecision], 2.0], $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{\left|n - m\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)}
\end{array}
Initial program 75.7%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites97.1%
Final simplification97.1%
(FPCore (K m n M l)
:precision binary64
(if (<= n 1e-281)
(* (exp (* -0.25 (* m m))) (cos M))
(if (<= n 4.5e-100)
(* (exp (- l)) (cos (- (/ K (/ 2.0 (+ n m))) M)))
(if (<= n 54.0)
(* (exp (* (- M) M)) (cos M))
(* (exp (* (* n n) -0.25)) 1.0)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 1e-281) {
tmp = exp((-0.25 * (m * m))) * cos(M);
} else if (n <= 4.5e-100) {
tmp = exp(-l) * cos(((K / (2.0 / (n + m))) - M));
} else if (n <= 54.0) {
tmp = exp((-M * M)) * cos(M);
} else {
tmp = exp(((n * n) * -0.25)) * 1.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 <= 1d-281) then
tmp = exp(((-0.25d0) * (m * m))) * cos(m_1)
else if (n <= 4.5d-100) then
tmp = exp(-l) * cos(((k / (2.0d0 / (n + m))) - m_1))
else if (n <= 54.0d0) then
tmp = exp((-m_1 * m_1)) * cos(m_1)
else
tmp = exp(((n * n) * (-0.25d0))) * 1.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 <= 1e-281) {
tmp = Math.exp((-0.25 * (m * m))) * Math.cos(M);
} else if (n <= 4.5e-100) {
tmp = Math.exp(-l) * Math.cos(((K / (2.0 / (n + m))) - M));
} else if (n <= 54.0) {
tmp = Math.exp((-M * M)) * Math.cos(M);
} else {
tmp = Math.exp(((n * n) * -0.25)) * 1.0;
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 1e-281: tmp = math.exp((-0.25 * (m * m))) * math.cos(M) elif n <= 4.5e-100: tmp = math.exp(-l) * math.cos(((K / (2.0 / (n + m))) - M)) elif n <= 54.0: tmp = math.exp((-M * M)) * math.cos(M) else: tmp = math.exp(((n * n) * -0.25)) * 1.0 return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 1e-281) tmp = Float64(exp(Float64(-0.25 * Float64(m * m))) * cos(M)); elseif (n <= 4.5e-100) tmp = Float64(exp(Float64(-l)) * cos(Float64(Float64(K / Float64(2.0 / Float64(n + m))) - M))); elseif (n <= 54.0) tmp = Float64(exp(Float64(Float64(-M) * M)) * cos(M)); else tmp = Float64(exp(Float64(Float64(n * n) * -0.25)) * 1.0); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 1e-281) tmp = exp((-0.25 * (m * m))) * cos(M); elseif (n <= 4.5e-100) tmp = exp(-l) * cos(((K / (2.0 / (n + m))) - M)); elseif (n <= 54.0) tmp = exp((-M * M)) * cos(M); else tmp = exp(((n * n) * -0.25)) * 1.0; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 1e-281], N[(N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[M], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.5e-100], N[(N[Exp[(-l)], $MachinePrecision] * N[Cos[N[(N[(K / N[(2.0 / N[(n + m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 54.0], N[(N[Exp[N[((-M) * M), $MachinePrecision]], $MachinePrecision] * N[Cos[M], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(n * n), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 10^{-281}:\\
\;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)} \cdot \cos M\\
\mathbf{elif}\;n \leq 4.5 \cdot 10^{-100}:\\
\;\;\;\;e^{-\ell} \cdot \cos \left(\frac{K}{\frac{2}{n + m}} - M\right)\\
\mathbf{elif}\;n \leq 54:\\
\;\;\;\;e^{\left(-M\right) \cdot M} \cdot \cos M\\
\mathbf{else}:\\
\;\;\;\;e^{\left(n \cdot n\right) \cdot -0.25} \cdot 1\\
\end{array}
\end{array}
if n < 1e-281Initial program 73.9%
Taylor expanded in m around inf
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6442.6
Applied rewrites42.6%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6460.5
Applied rewrites60.5%
if 1e-281 < n < 4.5000000000000001e-100Initial program 87.3%
Taylor expanded in l around inf
mul-1-negN/A
lower-neg.f6446.6
Applied rewrites46.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6447.5
lift-+.f64N/A
+-commutativeN/A
lift-+.f6447.5
Applied rewrites47.5%
if 4.5000000000000001e-100 < n < 54Initial program 79.1%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites87.1%
Taylor expanded in M around inf
Applied rewrites49.2%
if 54 < n Initial program 70.0%
Taylor expanded in l around inf
mul-1-negN/A
lower-neg.f6426.0
Applied rewrites26.0%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6434.9
Applied rewrites34.9%
Taylor expanded in n around inf
lower-*.f64N/A
unpow2N/A
lower-*.f6498.4
Applied rewrites98.4%
Taylor expanded in M around 0
Applied rewrites98.4%
Final simplification66.2%
(FPCore (K m n M l)
:precision binary64
(if (<= n 1e-281)
(* (exp (* -0.25 (* m m))) (cos M))
(if (<= n 4.5e-100)
(* (cos (- (fma (* 0.5 n) K (* (* m K) 0.5)) M)) (exp (- l)))
(if (<= n 54.0)
(* (exp (* (- M) M)) (cos M))
(* (exp (* (* n n) -0.25)) 1.0)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 1e-281) {
tmp = exp((-0.25 * (m * m))) * cos(M);
} else if (n <= 4.5e-100) {
tmp = cos((fma((0.5 * n), K, ((m * K) * 0.5)) - M)) * exp(-l);
} else if (n <= 54.0) {
tmp = exp((-M * M)) * cos(M);
} else {
tmp = exp(((n * n) * -0.25)) * 1.0;
}
return tmp;
}
function code(K, m, n, M, l) tmp = 0.0 if (n <= 1e-281) tmp = Float64(exp(Float64(-0.25 * Float64(m * m))) * cos(M)); elseif (n <= 4.5e-100) tmp = Float64(cos(Float64(fma(Float64(0.5 * n), K, Float64(Float64(m * K) * 0.5)) - M)) * exp(Float64(-l))); elseif (n <= 54.0) tmp = Float64(exp(Float64(Float64(-M) * M)) * cos(M)); else tmp = Float64(exp(Float64(Float64(n * n) * -0.25)) * 1.0); end return tmp end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 1e-281], N[(N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[M], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.5e-100], N[(N[Cos[N[(N[(N[(0.5 * n), $MachinePrecision] * K + N[(N[(m * K), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 54.0], N[(N[Exp[N[((-M) * M), $MachinePrecision]], $MachinePrecision] * N[Cos[M], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(n * n), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 10^{-281}:\\
\;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)} \cdot \cos M\\
\mathbf{elif}\;n \leq 4.5 \cdot 10^{-100}:\\
\;\;\;\;\cos \left(\mathsf{fma}\left(0.5 \cdot n, K, \left(m \cdot K\right) \cdot 0.5\right) - M\right) \cdot e^{-\ell}\\
\mathbf{elif}\;n \leq 54:\\
\;\;\;\;e^{\left(-M\right) \cdot M} \cdot \cos M\\
\mathbf{else}:\\
\;\;\;\;e^{\left(n \cdot n\right) \cdot -0.25} \cdot 1\\
\end{array}
\end{array}
if n < 1e-281Initial program 73.9%
Taylor expanded in m around inf
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6442.6
Applied rewrites42.6%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6460.5
Applied rewrites60.5%
if 1e-281 < n < 4.5000000000000001e-100Initial program 87.3%
Taylor expanded in l around inf
mul-1-negN/A
lower-neg.f6446.6
Applied rewrites46.6%
lift-/.f64N/A
div-invN/A
lift-*.f64N/A
metadata-evalN/A
associate-*r*N/A
*-commutativeN/A
lift-+.f64N/A
distribute-lft-inN/A
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6446.6
Applied rewrites46.6%
if 4.5000000000000001e-100 < n < 54Initial program 79.1%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites87.1%
Taylor expanded in M around inf
Applied rewrites49.2%
if 54 < n Initial program 70.0%
Taylor expanded in l around inf
mul-1-negN/A
lower-neg.f6426.0
Applied rewrites26.0%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6434.9
Applied rewrites34.9%
Taylor expanded in n around inf
lower-*.f64N/A
unpow2N/A
lower-*.f6498.4
Applied rewrites98.4%
Taylor expanded in M around 0
Applied rewrites98.4%
Final simplification66.0%
(FPCore (K m n M l)
:precision binary64
(if (<= n 1e-281)
(* (exp (* -0.25 (* m m))) (cos M))
(if (<= n 4.5e-100)
(* (cos (- (/ (* (+ n m) K) 2.0) M)) (exp (- l)))
(if (<= n 54.0)
(* (exp (* (- M) M)) (cos M))
(* (exp (* (* n n) -0.25)) 1.0)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 1e-281) {
tmp = exp((-0.25 * (m * m))) * cos(M);
} else if (n <= 4.5e-100) {
tmp = cos(((((n + m) * K) / 2.0) - M)) * exp(-l);
} else if (n <= 54.0) {
tmp = exp((-M * M)) * cos(M);
} else {
tmp = exp(((n * n) * -0.25)) * 1.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 <= 1d-281) then
tmp = exp(((-0.25d0) * (m * m))) * cos(m_1)
else if (n <= 4.5d-100) then
tmp = cos(((((n + m) * k) / 2.0d0) - m_1)) * exp(-l)
else if (n <= 54.0d0) then
tmp = exp((-m_1 * m_1)) * cos(m_1)
else
tmp = exp(((n * n) * (-0.25d0))) * 1.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 <= 1e-281) {
tmp = Math.exp((-0.25 * (m * m))) * Math.cos(M);
} else if (n <= 4.5e-100) {
tmp = Math.cos(((((n + m) * K) / 2.0) - M)) * Math.exp(-l);
} else if (n <= 54.0) {
tmp = Math.exp((-M * M)) * Math.cos(M);
} else {
tmp = Math.exp(((n * n) * -0.25)) * 1.0;
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 1e-281: tmp = math.exp((-0.25 * (m * m))) * math.cos(M) elif n <= 4.5e-100: tmp = math.cos(((((n + m) * K) / 2.0) - M)) * math.exp(-l) elif n <= 54.0: tmp = math.exp((-M * M)) * math.cos(M) else: tmp = math.exp(((n * n) * -0.25)) * 1.0 return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 1e-281) tmp = Float64(exp(Float64(-0.25 * Float64(m * m))) * cos(M)); elseif (n <= 4.5e-100) tmp = Float64(cos(Float64(Float64(Float64(Float64(n + m) * K) / 2.0) - M)) * exp(Float64(-l))); elseif (n <= 54.0) tmp = Float64(exp(Float64(Float64(-M) * M)) * cos(M)); else tmp = Float64(exp(Float64(Float64(n * n) * -0.25)) * 1.0); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 1e-281) tmp = exp((-0.25 * (m * m))) * cos(M); elseif (n <= 4.5e-100) tmp = cos(((((n + m) * K) / 2.0) - M)) * exp(-l); elseif (n <= 54.0) tmp = exp((-M * M)) * cos(M); else tmp = exp(((n * n) * -0.25)) * 1.0; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 1e-281], N[(N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[M], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.5e-100], N[(N[Cos[N[(N[(N[(N[(n + m), $MachinePrecision] * K), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 54.0], N[(N[Exp[N[((-M) * M), $MachinePrecision]], $MachinePrecision] * N[Cos[M], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(n * n), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 10^{-281}:\\
\;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)} \cdot \cos M\\
\mathbf{elif}\;n \leq 4.5 \cdot 10^{-100}:\\
\;\;\;\;\cos \left(\frac{\left(n + m\right) \cdot K}{2} - M\right) \cdot e^{-\ell}\\
\mathbf{elif}\;n \leq 54:\\
\;\;\;\;e^{\left(-M\right) \cdot M} \cdot \cos M\\
\mathbf{else}:\\
\;\;\;\;e^{\left(n \cdot n\right) \cdot -0.25} \cdot 1\\
\end{array}
\end{array}
if n < 1e-281Initial program 73.9%
Taylor expanded in m around inf
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6442.6
Applied rewrites42.6%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6460.5
Applied rewrites60.5%
if 1e-281 < n < 4.5000000000000001e-100Initial program 87.3%
Taylor expanded in l around inf
mul-1-negN/A
lower-neg.f6446.6
Applied rewrites46.6%
if 4.5000000000000001e-100 < n < 54Initial program 79.1%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites87.1%
Taylor expanded in M around inf
Applied rewrites49.2%
if 54 < n Initial program 70.0%
Taylor expanded in l around inf
mul-1-negN/A
lower-neg.f6426.0
Applied rewrites26.0%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6434.9
Applied rewrites34.9%
Taylor expanded in n around inf
lower-*.f64N/A
unpow2N/A
lower-*.f6498.4
Applied rewrites98.4%
Taylor expanded in M around 0
Applied rewrites98.4%
Final simplification66.0%
(FPCore (K m n M l)
:precision binary64
(if (<= m -0.88)
(* 1.0 (exp (* -0.25 (* m m))))
(if (<= m -4.5e-266)
(* (exp (* (- M) M)) (cos M))
(* (exp (* (* n n) -0.25)) (cos M)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -0.88) {
tmp = 1.0 * exp((-0.25 * (m * m)));
} else if (m <= -4.5e-266) {
tmp = exp((-M * M)) * cos(M);
} else {
tmp = exp(((n * n) * -0.25)) * cos(M);
}
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 <= (-0.88d0)) then
tmp = 1.0d0 * exp(((-0.25d0) * (m * m)))
else if (m <= (-4.5d-266)) then
tmp = exp((-m_1 * m_1)) * cos(m_1)
else
tmp = exp(((n * n) * (-0.25d0))) * cos(m_1)
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -0.88) {
tmp = 1.0 * Math.exp((-0.25 * (m * m)));
} else if (m <= -4.5e-266) {
tmp = Math.exp((-M * M)) * Math.cos(M);
} else {
tmp = Math.exp(((n * n) * -0.25)) * Math.cos(M);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -0.88: tmp = 1.0 * math.exp((-0.25 * (m * m))) elif m <= -4.5e-266: tmp = math.exp((-M * M)) * math.cos(M) else: tmp = math.exp(((n * n) * -0.25)) * math.cos(M) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -0.88) tmp = Float64(1.0 * exp(Float64(-0.25 * Float64(m * m)))); elseif (m <= -4.5e-266) tmp = Float64(exp(Float64(Float64(-M) * M)) * cos(M)); else tmp = Float64(exp(Float64(Float64(n * n) * -0.25)) * cos(M)); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -0.88) tmp = 1.0 * exp((-0.25 * (m * m))); elseif (m <= -4.5e-266) tmp = exp((-M * M)) * cos(M); else tmp = exp(((n * n) * -0.25)) * cos(M); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -0.88], N[(1.0 * N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, -4.5e-266], N[(N[Exp[N[((-M) * M), $MachinePrecision]], $MachinePrecision] * N[Cos[M], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(n * n), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision] * N[Cos[M], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.88:\\
\;\;\;\;1 \cdot e^{-0.25 \cdot \left(m \cdot m\right)}\\
\mathbf{elif}\;m \leq -4.5 \cdot 10^{-266}:\\
\;\;\;\;e^{\left(-M\right) \cdot M} \cdot \cos M\\
\mathbf{else}:\\
\;\;\;\;e^{\left(n \cdot n\right) \cdot -0.25} \cdot \cos M\\
\end{array}
\end{array}
if m < -0.880000000000000004Initial program 68.6%
Taylor expanded in m around inf
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6465.8
Applied rewrites65.8%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6495.8
Applied rewrites95.8%
Taylor expanded in M around 0
Applied rewrites95.8%
if -0.880000000000000004 < m < -4.5000000000000003e-266Initial program 72.1%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites91.0%
Taylor expanded in M around inf
Applied rewrites55.5%
if -4.5000000000000003e-266 < m Initial program 80.1%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites97.4%
Taylor expanded in n around inf
Applied rewrites50.0%
Final simplification63.4%
(FPCore (K m n M l)
:precision binary64
(if (<= m -0.88)
(* 1.0 (exp (* -0.25 (* m m))))
(if (<= m -4.5e-266)
(* (exp (* (- M) M)) (cos M))
(* (exp (* (* n n) -0.25)) 1.0))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -0.88) {
tmp = 1.0 * exp((-0.25 * (m * m)));
} else if (m <= -4.5e-266) {
tmp = exp((-M * M)) * cos(M);
} else {
tmp = exp(((n * n) * -0.25)) * 1.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 <= (-0.88d0)) then
tmp = 1.0d0 * exp(((-0.25d0) * (m * m)))
else if (m <= (-4.5d-266)) then
tmp = exp((-m_1 * m_1)) * cos(m_1)
else
tmp = exp(((n * n) * (-0.25d0))) * 1.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 <= -0.88) {
tmp = 1.0 * Math.exp((-0.25 * (m * m)));
} else if (m <= -4.5e-266) {
tmp = Math.exp((-M * M)) * Math.cos(M);
} else {
tmp = Math.exp(((n * n) * -0.25)) * 1.0;
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -0.88: tmp = 1.0 * math.exp((-0.25 * (m * m))) elif m <= -4.5e-266: tmp = math.exp((-M * M)) * math.cos(M) else: tmp = math.exp(((n * n) * -0.25)) * 1.0 return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -0.88) tmp = Float64(1.0 * exp(Float64(-0.25 * Float64(m * m)))); elseif (m <= -4.5e-266) tmp = Float64(exp(Float64(Float64(-M) * M)) * cos(M)); else tmp = Float64(exp(Float64(Float64(n * n) * -0.25)) * 1.0); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -0.88) tmp = 1.0 * exp((-0.25 * (m * m))); elseif (m <= -4.5e-266) tmp = exp((-M * M)) * cos(M); else tmp = exp(((n * n) * -0.25)) * 1.0; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -0.88], N[(1.0 * N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, -4.5e-266], N[(N[Exp[N[((-M) * M), $MachinePrecision]], $MachinePrecision] * N[Cos[M], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(n * n), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.88:\\
\;\;\;\;1 \cdot e^{-0.25 \cdot \left(m \cdot m\right)}\\
\mathbf{elif}\;m \leq -4.5 \cdot 10^{-266}:\\
\;\;\;\;e^{\left(-M\right) \cdot M} \cdot \cos M\\
\mathbf{else}:\\
\;\;\;\;e^{\left(n \cdot n\right) \cdot -0.25} \cdot 1\\
\end{array}
\end{array}
if m < -0.880000000000000004Initial program 68.6%
Taylor expanded in m around inf
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6465.8
Applied rewrites65.8%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6495.8
Applied rewrites95.8%
Taylor expanded in M around 0
Applied rewrites95.8%
if -0.880000000000000004 < m < -4.5000000000000003e-266Initial program 72.1%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites91.0%
Taylor expanded in M around inf
Applied rewrites55.5%
if -4.5000000000000003e-266 < m Initial program 80.1%
Taylor expanded in l around inf
mul-1-negN/A
lower-neg.f6433.1
Applied rewrites33.1%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6436.3
Applied rewrites36.3%
Taylor expanded in n around inf
lower-*.f64N/A
unpow2N/A
lower-*.f6450.0
Applied rewrites50.0%
Taylor expanded in M around 0
Applied rewrites50.0%
Final simplification63.4%
(FPCore (K m n M l) :precision binary64 (if (<= n 1e-281) (* 1.0 (exp (* -0.25 (* m m)))) (if (<= n 2.5e-5) (* (exp (- l)) (cos M)) (* (exp (* (* n n) -0.25)) 1.0))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 1e-281) {
tmp = 1.0 * exp((-0.25 * (m * m)));
} else if (n <= 2.5e-5) {
tmp = exp(-l) * cos(M);
} else {
tmp = exp(((n * n) * -0.25)) * 1.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 <= 1d-281) then
tmp = 1.0d0 * exp(((-0.25d0) * (m * m)))
else if (n <= 2.5d-5) then
tmp = exp(-l) * cos(m_1)
else
tmp = exp(((n * n) * (-0.25d0))) * 1.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 <= 1e-281) {
tmp = 1.0 * Math.exp((-0.25 * (m * m)));
} else if (n <= 2.5e-5) {
tmp = Math.exp(-l) * Math.cos(M);
} else {
tmp = Math.exp(((n * n) * -0.25)) * 1.0;
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 1e-281: tmp = 1.0 * math.exp((-0.25 * (m * m))) elif n <= 2.5e-5: tmp = math.exp(-l) * math.cos(M) else: tmp = math.exp(((n * n) * -0.25)) * 1.0 return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 1e-281) tmp = Float64(1.0 * exp(Float64(-0.25 * Float64(m * m)))); elseif (n <= 2.5e-5) tmp = Float64(exp(Float64(-l)) * cos(M)); else tmp = Float64(exp(Float64(Float64(n * n) * -0.25)) * 1.0); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 1e-281) tmp = 1.0 * exp((-0.25 * (m * m))); elseif (n <= 2.5e-5) tmp = exp(-l) * cos(M); else tmp = exp(((n * n) * -0.25)) * 1.0; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 1e-281], N[(1.0 * N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.5e-5], N[(N[Exp[(-l)], $MachinePrecision] * N[Cos[M], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(n * n), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 10^{-281}:\\
\;\;\;\;1 \cdot e^{-0.25 \cdot \left(m \cdot m\right)}\\
\mathbf{elif}\;n \leq 2.5 \cdot 10^{-5}:\\
\;\;\;\;e^{-\ell} \cdot \cos M\\
\mathbf{else}:\\
\;\;\;\;e^{\left(n \cdot n\right) \cdot -0.25} \cdot 1\\
\end{array}
\end{array}
if n < 1e-281Initial program 73.9%
Taylor expanded in m around inf
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6442.6
Applied rewrites42.6%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6460.5
Applied rewrites60.5%
Taylor expanded in M around 0
Applied rewrites60.5%
if 1e-281 < n < 2.50000000000000012e-5Initial program 84.7%
Taylor expanded in l around inf
mul-1-negN/A
lower-neg.f6445.5
Applied rewrites45.5%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6447.2
Applied rewrites47.2%
if 2.50000000000000012e-5 < n Initial program 70.6%
Taylor expanded in l around inf
mul-1-negN/A
lower-neg.f6424.8
Applied rewrites24.8%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6432.9
Applied rewrites32.9%
Taylor expanded in n around inf
lower-*.f64N/A
unpow2N/A
lower-*.f6492.4
Applied rewrites92.4%
Taylor expanded in M around 0
Applied rewrites92.4%
Final simplification65.2%
(FPCore (K m n M l) :precision binary64 (let* ((t_0 (* (exp (* (* n n) -0.25)) 1.0))) (if (<= n -2.7e-56) t_0 (if (<= n 2.5e-5) (* 1.0 (exp (- l))) t_0))))
double code(double K, double m, double n, double M, double l) {
double t_0 = exp(((n * n) * -0.25)) * 1.0;
double tmp;
if (n <= -2.7e-56) {
tmp = t_0;
} else if (n <= 2.5e-5) {
tmp = 1.0 * exp(-l);
} 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(((n * n) * (-0.25d0))) * 1.0d0
if (n <= (-2.7d-56)) then
tmp = t_0
else if (n <= 2.5d-5) then
tmp = 1.0d0 * exp(-l)
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(((n * n) * -0.25)) * 1.0;
double tmp;
if (n <= -2.7e-56) {
tmp = t_0;
} else if (n <= 2.5e-5) {
tmp = 1.0 * Math.exp(-l);
} else {
tmp = t_0;
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.exp(((n * n) * -0.25)) * 1.0 tmp = 0 if n <= -2.7e-56: tmp = t_0 elif n <= 2.5e-5: tmp = 1.0 * math.exp(-l) else: tmp = t_0 return tmp
function code(K, m, n, M, l) t_0 = Float64(exp(Float64(Float64(n * n) * -0.25)) * 1.0) tmp = 0.0 if (n <= -2.7e-56) tmp = t_0; elseif (n <= 2.5e-5) tmp = Float64(1.0 * exp(Float64(-l))); else tmp = t_0; end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = exp(((n * n) * -0.25)) * 1.0; tmp = 0.0; if (n <= -2.7e-56) tmp = t_0; elseif (n <= 2.5e-5) tmp = 1.0 * exp(-l); else tmp = t_0; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Exp[N[(N[(n * n), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]}, If[LessEqual[n, -2.7e-56], t$95$0, If[LessEqual[n, 2.5e-5], N[(1.0 * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\left(n \cdot n\right) \cdot -0.25} \cdot 1\\
\mathbf{if}\;n \leq -2.7 \cdot 10^{-56}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 2.5 \cdot 10^{-5}:\\
\;\;\;\;1 \cdot e^{-\ell}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -2.69999999999999995e-56 or 2.50000000000000012e-5 < n Initial program 67.5%
Taylor expanded in l around inf
mul-1-negN/A
lower-neg.f6421.9
Applied rewrites21.9%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6427.4
Applied rewrites27.4%
Taylor expanded in n around inf
lower-*.f64N/A
unpow2N/A
lower-*.f6486.9
Applied rewrites86.9%
Taylor expanded in M around 0
Applied rewrites86.9%
if -2.69999999999999995e-56 < n < 2.50000000000000012e-5Initial program 85.7%
Taylor expanded in l around inf
mul-1-negN/A
lower-neg.f6438.3
Applied rewrites38.3%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6441.1
Applied rewrites41.1%
Taylor expanded in M around 0
Applied rewrites39.4%
Final simplification65.6%
(FPCore (K m n M l) :precision binary64 (if (<= m -0.095) (* 1.0 (exp (* -0.25 (* m m)))) (* (exp (* (* n n) -0.25)) 1.0)))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -0.095) {
tmp = 1.0 * exp((-0.25 * (m * m)));
} else {
tmp = exp(((n * n) * -0.25)) * 1.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 <= (-0.095d0)) then
tmp = 1.0d0 * exp(((-0.25d0) * (m * m)))
else
tmp = exp(((n * n) * (-0.25d0))) * 1.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 <= -0.095) {
tmp = 1.0 * Math.exp((-0.25 * (m * m)));
} else {
tmp = Math.exp(((n * n) * -0.25)) * 1.0;
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -0.095: tmp = 1.0 * math.exp((-0.25 * (m * m))) else: tmp = math.exp(((n * n) * -0.25)) * 1.0 return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -0.095) tmp = Float64(1.0 * exp(Float64(-0.25 * Float64(m * m)))); else tmp = Float64(exp(Float64(Float64(n * n) * -0.25)) * 1.0); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -0.095) tmp = 1.0 * exp((-0.25 * (m * m))); else tmp = exp(((n * n) * -0.25)) * 1.0; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -0.095], N[(1.0 * N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(n * n), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.095:\\
\;\;\;\;1 \cdot e^{-0.25 \cdot \left(m \cdot m\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(n \cdot n\right) \cdot -0.25} \cdot 1\\
\end{array}
\end{array}
if m < -0.095000000000000001Initial program 69.0%
Taylor expanded in m around inf
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6464.9
Applied rewrites64.9%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6494.5
Applied rewrites94.5%
Taylor expanded in M around 0
Applied rewrites94.5%
if -0.095000000000000001 < m Initial program 78.2%
Taylor expanded in l around inf
mul-1-negN/A
lower-neg.f6434.0
Applied rewrites34.0%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6437.6
Applied rewrites37.6%
Taylor expanded in n around inf
lower-*.f64N/A
unpow2N/A
lower-*.f6450.9
Applied rewrites50.9%
Taylor expanded in M around 0
Applied rewrites50.9%
Final simplification63.0%
(FPCore (K m n M l) :precision binary64 (* 1.0 (exp (- l))))
double code(double K, double m, double n, double M, double l) {
return 1.0 * 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 = 1.0d0 * exp(-l)
end function
public static double code(double K, double m, double n, double M, double l) {
return 1.0 * Math.exp(-l);
}
def code(K, m, n, M, l): return 1.0 * math.exp(-l)
function code(K, m, n, M, l) return Float64(1.0 * exp(Float64(-l))) end
function tmp = code(K, m, n, M, l) tmp = 1.0 * exp(-l); end
code[K_, m_, n_, M_, l_] := N[(1.0 * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 \cdot e^{-\ell}
\end{array}
Initial program 75.7%
Taylor expanded in l around inf
mul-1-negN/A
lower-neg.f6429.3
Applied rewrites29.3%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6433.6
Applied rewrites33.6%
Taylor expanded in M around 0
Applied rewrites32.8%
herbie shell --seed 2024288
(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)))))))