
(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 78.4%
Taylor expanded in K around 0 97.4%
cos-neg97.4%
Simplified97.4%
Final simplification97.4%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (exp (- (+ m (* 0.5 (* m (+ n (* m 0.5))))) (+ n l))))
(t_1 (* (cos M) (exp (+ (* M (- n M)) (- (fabs (- m n)) l))))))
(if (<= m -55.0)
(exp (* -0.25 (pow m 2.0)))
(if (<= m -2e-205)
(* t_0 (cos (- (/ (* m K) 2.0) M)))
(if (<= m 7.4e-269)
t_1
(if (<= m 3.6e-96)
(* (cos (- M)) t_0)
(if (<= m 1.15e-45) t_1 (* (cos M) (exp (* n (* m -0.5)))))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = exp(((m + (0.5 * (m * (n + (m * 0.5))))) - (n + l)));
double t_1 = cos(M) * exp(((M * (n - M)) + (fabs((m - n)) - l)));
double tmp;
if (m <= -55.0) {
tmp = exp((-0.25 * pow(m, 2.0)));
} else if (m <= -2e-205) {
tmp = t_0 * cos((((m * K) / 2.0) - M));
} else if (m <= 7.4e-269) {
tmp = t_1;
} else if (m <= 3.6e-96) {
tmp = cos(-M) * t_0;
} else if (m <= 1.15e-45) {
tmp = t_1;
} else {
tmp = cos(M) * exp((n * (m * -0.5)));
}
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) :: t_1
real(8) :: tmp
t_0 = exp(((m + (0.5d0 * (m * (n + (m * 0.5d0))))) - (n + l)))
t_1 = cos(m_1) * exp(((m_1 * (n - m_1)) + (abs((m - n)) - l)))
if (m <= (-55.0d0)) then
tmp = exp(((-0.25d0) * (m ** 2.0d0)))
else if (m <= (-2d-205)) then
tmp = t_0 * cos((((m * k) / 2.0d0) - m_1))
else if (m <= 7.4d-269) then
tmp = t_1
else if (m <= 3.6d-96) then
tmp = cos(-m_1) * t_0
else if (m <= 1.15d-45) then
tmp = t_1
else
tmp = cos(m_1) * exp((n * (m * (-0.5d0))))
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 + (0.5 * (m * (n + (m * 0.5))))) - (n + l)));
double t_1 = Math.cos(M) * Math.exp(((M * (n - M)) + (Math.abs((m - n)) - l)));
double tmp;
if (m <= -55.0) {
tmp = Math.exp((-0.25 * Math.pow(m, 2.0)));
} else if (m <= -2e-205) {
tmp = t_0 * Math.cos((((m * K) / 2.0) - M));
} else if (m <= 7.4e-269) {
tmp = t_1;
} else if (m <= 3.6e-96) {
tmp = Math.cos(-M) * t_0;
} else if (m <= 1.15e-45) {
tmp = t_1;
} else {
tmp = Math.cos(M) * Math.exp((n * (m * -0.5)));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.exp(((m + (0.5 * (m * (n + (m * 0.5))))) - (n + l))) t_1 = math.cos(M) * math.exp(((M * (n - M)) + (math.fabs((m - n)) - l))) tmp = 0 if m <= -55.0: tmp = math.exp((-0.25 * math.pow(m, 2.0))) elif m <= -2e-205: tmp = t_0 * math.cos((((m * K) / 2.0) - M)) elif m <= 7.4e-269: tmp = t_1 elif m <= 3.6e-96: tmp = math.cos(-M) * t_0 elif m <= 1.15e-45: tmp = t_1 else: tmp = math.cos(M) * math.exp((n * (m * -0.5))) return tmp
function code(K, m, n, M, l) t_0 = exp(Float64(Float64(m + Float64(0.5 * Float64(m * Float64(n + Float64(m * 0.5))))) - Float64(n + l))) t_1 = Float64(cos(M) * exp(Float64(Float64(M * Float64(n - M)) + Float64(abs(Float64(m - n)) - l)))) tmp = 0.0 if (m <= -55.0) tmp = exp(Float64(-0.25 * (m ^ 2.0))); elseif (m <= -2e-205) tmp = Float64(t_0 * cos(Float64(Float64(Float64(m * K) / 2.0) - M))); elseif (m <= 7.4e-269) tmp = t_1; elseif (m <= 3.6e-96) tmp = Float64(cos(Float64(-M)) * t_0); elseif (m <= 1.15e-45) tmp = t_1; else tmp = Float64(cos(M) * exp(Float64(n * Float64(m * -0.5)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = exp(((m + (0.5 * (m * (n + (m * 0.5))))) - (n + l))); t_1 = cos(M) * exp(((M * (n - M)) + (abs((m - n)) - l))); tmp = 0.0; if (m <= -55.0) tmp = exp((-0.25 * (m ^ 2.0))); elseif (m <= -2e-205) tmp = t_0 * cos((((m * K) / 2.0) - M)); elseif (m <= 7.4e-269) tmp = t_1; elseif (m <= 3.6e-96) tmp = cos(-M) * t_0; elseif (m <= 1.15e-45) tmp = t_1; else tmp = cos(M) * exp((n * (m * -0.5))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[N[(N[(m + N[(0.5 * N[(m * N[(n + N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(n + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(M * N[(n - M), $MachinePrecision]), $MachinePrecision] + N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -55.0], N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[m, -2e-205], N[(t$95$0 * N[Cos[N[(N[(N[(m * K), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 7.4e-269], t$95$1, If[LessEqual[m, 3.6e-96], N[(N[Cos[(-M)], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[m, 1.15e-45], t$95$1, N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(n * N[(m * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\left(m + 0.5 \cdot \left(m \cdot \left(n + m \cdot 0.5\right)\right)\right) - \left(n + \ell\right)}\\
t_1 := \cos M \cdot e^{M \cdot \left(n - M\right) + \left(\left|m - n\right| - \ell\right)}\\
\mathbf{if}\;m \leq -55:\\
\;\;\;\;e^{-0.25 \cdot {m}^{2}}\\
\mathbf{elif}\;m \leq -2 \cdot 10^{-205}:\\
\;\;\;\;t\_0 \cdot \cos \left(\frac{m \cdot K}{2} - M\right)\\
\mathbf{elif}\;m \leq 7.4 \cdot 10^{-269}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;m \leq 3.6 \cdot 10^{-96}:\\
\;\;\;\;\cos \left(-M\right) \cdot t\_0\\
\mathbf{elif}\;m \leq 1.15 \cdot 10^{-45}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{n \cdot \left(m \cdot -0.5\right)}\\
\end{array}
\end{array}
if m < -55Initial program 75.4%
Taylor expanded in K around 0 98.2%
cos-neg98.2%
Simplified98.2%
Taylor expanded in n around 0 82.5%
+-commutative82.5%
unpow282.5%
distribute-rgt-out93.1%
*-commutative93.1%
*-commutative93.1%
Simplified93.1%
Taylor expanded in m around inf 98.3%
*-commutative98.3%
Simplified98.3%
Taylor expanded in M around 0 98.3%
if -55 < m < -2e-205Initial program 80.0%
*-un-lft-identity80.0%
*-commutative80.0%
Applied egg-rr33.2%
Taylor expanded in n around 0 47.9%
+-commutative47.9%
unpow247.9%
distribute-rgt-out50.5%
Simplified50.5%
Taylor expanded in M around 0 65.4%
Taylor expanded in m around inf 75.5%
if -2e-205 < m < 7.39999999999999955e-269 or 3.60000000000000008e-96 < m < 1.14999999999999996e-45Initial program 89.2%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around 0 81.3%
+-commutative81.3%
unpow281.3%
distribute-rgt-out84.0%
*-commutative84.0%
*-commutative84.0%
Simplified84.0%
Taylor expanded in m around 0 84.0%
fabs-sub84.0%
sub-neg84.0%
mul-1-neg84.0%
fabs-neg84.0%
associate--r+84.0%
associate-*r*84.0%
neg-mul-184.0%
cancel-sign-sub84.0%
fabs-neg84.0%
mul-1-neg84.0%
sub-neg84.0%
Simplified84.0%
if 7.39999999999999955e-269 < m < 3.60000000000000008e-96Initial program 88.9%
*-un-lft-identity88.9%
*-commutative88.9%
Applied egg-rr23.9%
Taylor expanded in n around 0 29.5%
+-commutative29.5%
unpow229.5%
distribute-rgt-out32.5%
Simplified32.5%
Taylor expanded in M around 0 38.6%
Taylor expanded in K around 0 41.0%
if 1.14999999999999996e-45 < m Initial program 71.1%
Taylor expanded in K around 0 98.0%
cos-neg98.0%
Simplified98.0%
Taylor expanded in n around 0 74.3%
+-commutative74.3%
unpow274.3%
distribute-rgt-out86.8%
*-commutative86.8%
*-commutative86.8%
Simplified86.8%
Taylor expanded in n around inf 39.0%
Taylor expanded in M around 0 31.2%
associate-*r*31.2%
*-commutative31.2%
Simplified31.2%
Final simplification62.0%
(FPCore (K m n M l)
:precision binary64
(if (<= n 1.8e+92)
(*
(cos M)
(exp (+ (* (- (* m 0.5) M) (- (- M (* m 0.5)) n)) (- (fabs (- m n)) l))))
(* (cos (- M)) (exp (- (+ m (* 0.5 (* m (+ n (* m 0.5))))) (+ n l))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 1.8e+92) {
tmp = cos(M) * exp(((((m * 0.5) - M) * ((M - (m * 0.5)) - n)) + (fabs((m - n)) - l)));
} else {
tmp = cos(-M) * exp(((m + (0.5 * (m * (n + (m * 0.5))))) - (n + 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 (n <= 1.8d+92) then
tmp = cos(m_1) * exp(((((m * 0.5d0) - m_1) * ((m_1 - (m * 0.5d0)) - n)) + (abs((m - n)) - l)))
else
tmp = cos(-m_1) * exp(((m + (0.5d0 * (m * (n + (m * 0.5d0))))) - (n + l)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 1.8e+92) {
tmp = Math.cos(M) * Math.exp(((((m * 0.5) - M) * ((M - (m * 0.5)) - n)) + (Math.abs((m - n)) - l)));
} else {
tmp = Math.cos(-M) * Math.exp(((m + (0.5 * (m * (n + (m * 0.5))))) - (n + l)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 1.8e+92: tmp = math.cos(M) * math.exp(((((m * 0.5) - M) * ((M - (m * 0.5)) - n)) + (math.fabs((m - n)) - l))) else: tmp = math.cos(-M) * math.exp(((m + (0.5 * (m * (n + (m * 0.5))))) - (n + l))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 1.8e+92) tmp = Float64(cos(M) * exp(Float64(Float64(Float64(Float64(m * 0.5) - M) * Float64(Float64(M - Float64(m * 0.5)) - n)) + Float64(abs(Float64(m - n)) - l)))); else tmp = Float64(cos(Float64(-M)) * exp(Float64(Float64(m + Float64(0.5 * Float64(m * Float64(n + Float64(m * 0.5))))) - Float64(n + l)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 1.8e+92) tmp = cos(M) * exp(((((m * 0.5) - M) * ((M - (m * 0.5)) - n)) + (abs((m - n)) - l))); else tmp = cos(-M) * exp(((m + (0.5 * (m * (n + (m * 0.5))))) - (n + l))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 1.8e+92], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(N[(N[(m * 0.5), $MachinePrecision] - M), $MachinePrecision] * N[(N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision] - n), $MachinePrecision]), $MachinePrecision] + N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[(-M)], $MachinePrecision] * N[Exp[N[(N[(m + N[(0.5 * N[(m * N[(n + N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(n + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 1.8 \cdot 10^{+92}:\\
\;\;\;\;\cos M \cdot e^{\left(m \cdot 0.5 - M\right) \cdot \left(\left(M - m \cdot 0.5\right) - n\right) + \left(\left|m - n\right| - \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(-M\right) \cdot e^{\left(m + 0.5 \cdot \left(m \cdot \left(n + m \cdot 0.5\right)\right)\right) - \left(n + \ell\right)}\\
\end{array}
\end{array}
if n < 1.8e92Initial program 78.4%
Taylor expanded in K around 0 96.9%
cos-neg96.9%
Simplified96.9%
Taylor expanded in n around 0 80.6%
+-commutative80.6%
unpow280.6%
distribute-rgt-out87.0%
*-commutative87.0%
*-commutative87.0%
Simplified87.0%
if 1.8e92 < n Initial program 78.4%
*-un-lft-identity78.4%
*-commutative78.4%
Applied egg-rr1.2%
Taylor expanded in n around 0 24.9%
+-commutative24.9%
unpow224.9%
distribute-rgt-out33.2%
Simplified33.2%
Taylor expanded in M around 0 46.5%
Taylor expanded in K around 0 52.1%
Final simplification82.0%
(FPCore (K m n M l)
:precision binary64
(if (<= m -600000000.0)
(exp (* -0.25 (pow m 2.0)))
(*
(cos M)
(exp (+ (* (- (* n 0.5) M) (- (- M (* n 0.5)) m)) (- (fabs (- m n)) l))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -600000000.0) {
tmp = exp((-0.25 * pow(m, 2.0)));
} else {
tmp = cos(M) * exp(((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) + (fabs((m - n)) - l)));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (m <= (-600000000.0d0)) then
tmp = exp(((-0.25d0) * (m ** 2.0d0)))
else
tmp = cos(m_1) * exp(((((n * 0.5d0) - m_1) * ((m_1 - (n * 0.5d0)) - m)) + (abs((m - n)) - l)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -600000000.0) {
tmp = Math.exp((-0.25 * Math.pow(m, 2.0)));
} else {
tmp = Math.cos(M) * Math.exp(((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) + (Math.abs((m - n)) - l)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -600000000.0: tmp = math.exp((-0.25 * math.pow(m, 2.0))) else: tmp = math.cos(M) * math.exp(((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) + (math.fabs((m - n)) - l))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -600000000.0) tmp = exp(Float64(-0.25 * (m ^ 2.0))); else tmp = Float64(cos(M) * exp(Float64(Float64(Float64(Float64(n * 0.5) - M) * Float64(Float64(M - Float64(n * 0.5)) - m)) + Float64(abs(Float64(m - n)) - l)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -600000000.0) tmp = exp((-0.25 * (m ^ 2.0))); else tmp = cos(M) * exp(((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) + (abs((m - n)) - l))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -600000000.0], N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(N[(N[(n * 0.5), $MachinePrecision] - M), $MachinePrecision] * N[(N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision] - m), $MachinePrecision]), $MachinePrecision] + N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -600000000:\\
\;\;\;\;e^{-0.25 \cdot {m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{\left(n \cdot 0.5 - M\right) \cdot \left(\left(M - n \cdot 0.5\right) - m\right) + \left(\left|m - n\right| - \ell\right)}\\
\end{array}
\end{array}
if m < -6e8Initial program 75.4%
Taylor expanded in K around 0 98.2%
cos-neg98.2%
Simplified98.2%
Taylor expanded in n around 0 82.5%
+-commutative82.5%
unpow282.5%
distribute-rgt-out93.1%
*-commutative93.1%
*-commutative93.1%
Simplified93.1%
Taylor expanded in m around inf 98.3%
*-commutative98.3%
Simplified98.3%
Taylor expanded in M around 0 98.3%
if -6e8 < m Initial program 79.3%
Taylor expanded in K around 0 97.1%
cos-neg97.1%
Simplified97.1%
Taylor expanded in m around 0 78.7%
+-commutative78.7%
unpow278.7%
distribute-rgt-out82.3%
*-commutative82.3%
*-commutative82.3%
Simplified82.3%
Final simplification85.8%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (exp (- (+ m (* 0.5 (* m (+ n (* m 0.5))))) (+ n l)))))
(if (<= m -53.0)
(exp (* -0.25 (pow m 2.0)))
(if (<= m -2.5e-265)
(* t_0 (cos (- (/ (* m K) 2.0) M)))
(if (<= m 4.7e-268)
(* (cos M) (exp (- (pow M 2.0))))
(if (<= m 1.24e-45)
(* (cos (- M)) t_0)
(* (cos M) (exp (* n (* m -0.5))))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = exp(((m + (0.5 * (m * (n + (m * 0.5))))) - (n + l)));
double tmp;
if (m <= -53.0) {
tmp = exp((-0.25 * pow(m, 2.0)));
} else if (m <= -2.5e-265) {
tmp = t_0 * cos((((m * K) / 2.0) - M));
} else if (m <= 4.7e-268) {
tmp = cos(M) * exp(-pow(M, 2.0));
} else if (m <= 1.24e-45) {
tmp = cos(-M) * t_0;
} else {
tmp = cos(M) * exp((n * (m * -0.5)));
}
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 + (0.5d0 * (m * (n + (m * 0.5d0))))) - (n + l)))
if (m <= (-53.0d0)) then
tmp = exp(((-0.25d0) * (m ** 2.0d0)))
else if (m <= (-2.5d-265)) then
tmp = t_0 * cos((((m * k) / 2.0d0) - m_1))
else if (m <= 4.7d-268) then
tmp = cos(m_1) * exp(-(m_1 ** 2.0d0))
else if (m <= 1.24d-45) then
tmp = cos(-m_1) * t_0
else
tmp = cos(m_1) * exp((n * (m * (-0.5d0))))
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 + (0.5 * (m * (n + (m * 0.5))))) - (n + l)));
double tmp;
if (m <= -53.0) {
tmp = Math.exp((-0.25 * Math.pow(m, 2.0)));
} else if (m <= -2.5e-265) {
tmp = t_0 * Math.cos((((m * K) / 2.0) - M));
} else if (m <= 4.7e-268) {
tmp = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
} else if (m <= 1.24e-45) {
tmp = Math.cos(-M) * t_0;
} else {
tmp = Math.cos(M) * Math.exp((n * (m * -0.5)));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.exp(((m + (0.5 * (m * (n + (m * 0.5))))) - (n + l))) tmp = 0 if m <= -53.0: tmp = math.exp((-0.25 * math.pow(m, 2.0))) elif m <= -2.5e-265: tmp = t_0 * math.cos((((m * K) / 2.0) - M)) elif m <= 4.7e-268: tmp = math.cos(M) * math.exp(-math.pow(M, 2.0)) elif m <= 1.24e-45: tmp = math.cos(-M) * t_0 else: tmp = math.cos(M) * math.exp((n * (m * -0.5))) return tmp
function code(K, m, n, M, l) t_0 = exp(Float64(Float64(m + Float64(0.5 * Float64(m * Float64(n + Float64(m * 0.5))))) - Float64(n + l))) tmp = 0.0 if (m <= -53.0) tmp = exp(Float64(-0.25 * (m ^ 2.0))); elseif (m <= -2.5e-265) tmp = Float64(t_0 * cos(Float64(Float64(Float64(m * K) / 2.0) - M))); elseif (m <= 4.7e-268) tmp = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))); elseif (m <= 1.24e-45) tmp = Float64(cos(Float64(-M)) * t_0); else tmp = Float64(cos(M) * exp(Float64(n * Float64(m * -0.5)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = exp(((m + (0.5 * (m * (n + (m * 0.5))))) - (n + l))); tmp = 0.0; if (m <= -53.0) tmp = exp((-0.25 * (m ^ 2.0))); elseif (m <= -2.5e-265) tmp = t_0 * cos((((m * K) / 2.0) - M)); elseif (m <= 4.7e-268) tmp = cos(M) * exp(-(M ^ 2.0)); elseif (m <= 1.24e-45) tmp = cos(-M) * t_0; else tmp = cos(M) * exp((n * (m * -0.5))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[N[(N[(m + N[(0.5 * N[(m * N[(n + N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(n + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[m, -53.0], N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[m, -2.5e-265], N[(t$95$0 * N[Cos[N[(N[(N[(m * K), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 4.7e-268], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.24e-45], N[(N[Cos[(-M)], $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(n * N[(m * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\left(m + 0.5 \cdot \left(m \cdot \left(n + m \cdot 0.5\right)\right)\right) - \left(n + \ell\right)}\\
\mathbf{if}\;m \leq -53:\\
\;\;\;\;e^{-0.25 \cdot {m}^{2}}\\
\mathbf{elif}\;m \leq -2.5 \cdot 10^{-265}:\\
\;\;\;\;t\_0 \cdot \cos \left(\frac{m \cdot K}{2} - M\right)\\
\mathbf{elif}\;m \leq 4.7 \cdot 10^{-268}:\\
\;\;\;\;\cos M \cdot e^{-{M}^{2}}\\
\mathbf{elif}\;m \leq 1.24 \cdot 10^{-45}:\\
\;\;\;\;\cos \left(-M\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{n \cdot \left(m \cdot -0.5\right)}\\
\end{array}
\end{array}
if m < -53Initial program 75.4%
Taylor expanded in K around 0 98.2%
cos-neg98.2%
Simplified98.2%
Taylor expanded in n around 0 82.5%
+-commutative82.5%
unpow282.5%
distribute-rgt-out93.1%
*-commutative93.1%
*-commutative93.1%
Simplified93.1%
Taylor expanded in m around inf 98.3%
*-commutative98.3%
Simplified98.3%
Taylor expanded in M around 0 98.3%
if -53 < m < -2.5e-265Initial program 82.6%
*-un-lft-identity82.6%
*-commutative82.6%
Applied egg-rr37.7%
Taylor expanded in n around 0 52.6%
+-commutative52.6%
unpow252.6%
distribute-rgt-out54.8%
Simplified54.8%
Taylor expanded in M around 0 67.7%
Taylor expanded in m around inf 76.5%
if -2.5e-265 < m < 4.69999999999999973e-268Initial program 78.6%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around 0 78.9%
+-commutative78.9%
unpow278.9%
distribute-rgt-out78.9%
*-commutative78.9%
*-commutative78.9%
Simplified78.9%
Taylor expanded in M around inf 72.3%
mul-1-neg72.3%
Simplified72.3%
if 4.69999999999999973e-268 < m < 1.24e-45Initial program 90.7%
*-un-lft-identity90.7%
*-commutative90.7%
Applied egg-rr26.0%
Taylor expanded in n around 0 35.6%
+-commutative35.6%
unpow235.6%
distribute-rgt-out37.6%
Simplified37.6%
Taylor expanded in M around 0 41.8%
Taylor expanded in K around 0 43.4%
if 1.24e-45 < m Initial program 71.1%
Taylor expanded in K around 0 98.0%
cos-neg98.0%
Simplified98.0%
Taylor expanded in n around 0 74.3%
+-commutative74.3%
unpow274.3%
distribute-rgt-out86.8%
*-commutative86.8%
*-commutative86.8%
Simplified86.8%
Taylor expanded in n around inf 39.0%
Taylor expanded in M around 0 31.2%
associate-*r*31.2%
*-commutative31.2%
Simplified31.2%
Final simplification59.0%
(FPCore (K m n M l)
:precision binary64
(if (<= m -55.0)
(exp (* -0.25 (pow m 2.0)))
(if (<= m 1.24e-45)
(* (cos (- M)) (exp (- (+ m (* 0.5 (* m (+ n (* m 0.5))))) (+ n l))))
(* (cos M) (exp (* n (* m -0.5)))))))
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 <= 1.24e-45) {
tmp = cos(-M) * exp(((m + (0.5 * (m * (n + (m * 0.5))))) - (n + l)));
} else {
tmp = cos(M) * exp((n * (m * -0.5)));
}
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 <= 1.24d-45) then
tmp = cos(-m_1) * exp(((m + (0.5d0 * (m * (n + (m * 0.5d0))))) - (n + l)))
else
tmp = cos(m_1) * exp((n * (m * (-0.5d0))))
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 <= 1.24e-45) {
tmp = Math.cos(-M) * Math.exp(((m + (0.5 * (m * (n + (m * 0.5))))) - (n + l)));
} else {
tmp = Math.cos(M) * Math.exp((n * (m * -0.5)));
}
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 <= 1.24e-45: tmp = math.cos(-M) * math.exp(((m + (0.5 * (m * (n + (m * 0.5))))) - (n + l))) else: tmp = math.cos(M) * math.exp((n * (m * -0.5))) 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 <= 1.24e-45) tmp = Float64(cos(Float64(-M)) * exp(Float64(Float64(m + Float64(0.5 * Float64(m * Float64(n + Float64(m * 0.5))))) - Float64(n + l)))); else tmp = Float64(cos(M) * exp(Float64(n * Float64(m * -0.5)))); 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 <= 1.24e-45) tmp = cos(-M) * exp(((m + (0.5 * (m * (n + (m * 0.5))))) - (n + l))); else tmp = cos(M) * exp((n * (m * -0.5))); 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, 1.24e-45], N[(N[Cos[(-M)], $MachinePrecision] * N[Exp[N[(N[(m + N[(0.5 * N[(m * N[(n + N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(n + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(n * N[(m * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -55:\\
\;\;\;\;e^{-0.25 \cdot {m}^{2}}\\
\mathbf{elif}\;m \leq 1.24 \cdot 10^{-45}:\\
\;\;\;\;\cos \left(-M\right) \cdot e^{\left(m + 0.5 \cdot \left(m \cdot \left(n + m \cdot 0.5\right)\right)\right) - \left(n + \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{n \cdot \left(m \cdot -0.5\right)}\\
\end{array}
\end{array}
if m < -55Initial program 75.4%
Taylor expanded in K around 0 98.2%
cos-neg98.2%
Simplified98.2%
Taylor expanded in n around 0 82.5%
+-commutative82.5%
unpow282.5%
distribute-rgt-out93.1%
*-commutative93.1%
*-commutative93.1%
Simplified93.1%
Taylor expanded in m around inf 98.3%
*-commutative98.3%
Simplified98.3%
Taylor expanded in M around 0 98.3%
if -55 < m < 1.24e-45Initial program 85.8%
*-un-lft-identity85.8%
*-commutative85.8%
Applied egg-rr29.5%
Taylor expanded in n around 0 40.1%
+-commutative40.1%
unpow240.1%
distribute-rgt-out41.9%
Simplified41.9%
Taylor expanded in M around 0 51.0%
Taylor expanded in K around 0 54.5%
if 1.24e-45 < m Initial program 71.1%
Taylor expanded in K around 0 98.0%
cos-neg98.0%
Simplified98.0%
Taylor expanded in n around 0 74.3%
+-commutative74.3%
unpow274.3%
distribute-rgt-out86.8%
*-commutative86.8%
*-commutative86.8%
Simplified86.8%
Taylor expanded in n around inf 39.0%
Taylor expanded in M around 0 31.2%
associate-*r*31.2%
*-commutative31.2%
Simplified31.2%
Final simplification56.3%
(FPCore (K m n M l)
:precision binary64
(if (<= m -53.0)
(exp (* -0.25 (pow m 2.0)))
(if (<= m 2e-50)
(/ (cos (- (* n (* 0.5 K)) M)) (exp (+ n l)))
(* (cos M) (exp (* n (* m -0.5)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -53.0) {
tmp = exp((-0.25 * pow(m, 2.0)));
} else if (m <= 2e-50) {
tmp = cos(((n * (0.5 * K)) - M)) / exp((n + l));
} else {
tmp = cos(M) * exp((n * (m * -0.5)));
}
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 <= (-53.0d0)) then
tmp = exp(((-0.25d0) * (m ** 2.0d0)))
else if (m <= 2d-50) then
tmp = cos(((n * (0.5d0 * k)) - m_1)) / exp((n + l))
else
tmp = cos(m_1) * exp((n * (m * (-0.5d0))))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -53.0) {
tmp = Math.exp((-0.25 * Math.pow(m, 2.0)));
} else if (m <= 2e-50) {
tmp = Math.cos(((n * (0.5 * K)) - M)) / Math.exp((n + l));
} else {
tmp = Math.cos(M) * Math.exp((n * (m * -0.5)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -53.0: tmp = math.exp((-0.25 * math.pow(m, 2.0))) elif m <= 2e-50: tmp = math.cos(((n * (0.5 * K)) - M)) / math.exp((n + l)) else: tmp = math.cos(M) * math.exp((n * (m * -0.5))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -53.0) tmp = exp(Float64(-0.25 * (m ^ 2.0))); elseif (m <= 2e-50) tmp = Float64(cos(Float64(Float64(n * Float64(0.5 * K)) - M)) / exp(Float64(n + l))); else tmp = Float64(cos(M) * exp(Float64(n * Float64(m * -0.5)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -53.0) tmp = exp((-0.25 * (m ^ 2.0))); elseif (m <= 2e-50) tmp = cos(((n * (0.5 * K)) - M)) / exp((n + l)); else tmp = cos(M) * exp((n * (m * -0.5))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -53.0], N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[m, 2e-50], N[(N[Cos[N[(N[(n * N[(0.5 * K), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] / N[Exp[N[(n + l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(n * N[(m * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -53:\\
\;\;\;\;e^{-0.25 \cdot {m}^{2}}\\
\mathbf{elif}\;m \leq 2 \cdot 10^{-50}:\\
\;\;\;\;\frac{\cos \left(n \cdot \left(0.5 \cdot K\right) - M\right)}{e^{n + \ell}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{n \cdot \left(m \cdot -0.5\right)}\\
\end{array}
\end{array}
if m < -53Initial program 75.4%
Taylor expanded in K around 0 98.2%
cos-neg98.2%
Simplified98.2%
Taylor expanded in n around 0 82.5%
+-commutative82.5%
unpow282.5%
distribute-rgt-out93.1%
*-commutative93.1%
*-commutative93.1%
Simplified93.1%
Taylor expanded in m around inf 98.3%
*-commutative98.3%
Simplified98.3%
Taylor expanded in M around 0 98.3%
if -53 < m < 2.00000000000000002e-50Initial program 85.7%
*-un-lft-identity85.7%
*-commutative85.7%
Applied egg-rr29.8%
Taylor expanded in n around 0 39.5%
+-commutative39.5%
unpow239.5%
distribute-rgt-out41.4%
Simplified41.4%
Taylor expanded in M around 0 51.5%
Taylor expanded in m around 0 52.4%
exp-neg52.4%
associate-*r/52.4%
*-rgt-identity52.4%
associate-*r*52.4%
+-commutative52.4%
Simplified52.4%
if 2.00000000000000002e-50 < m Initial program 71.4%
Taylor expanded in K around 0 98.0%
cos-neg98.0%
Simplified98.0%
Taylor expanded in n around 0 73.5%
+-commutative73.5%
unpow273.5%
distribute-rgt-out85.8%
*-commutative85.8%
*-commutative85.8%
Simplified85.8%
Taylor expanded in n around inf 38.5%
Taylor expanded in M around 0 30.9%
associate-*r*30.9%
*-commutative30.9%
Simplified30.9%
Final simplification55.1%
(FPCore (K m n M l)
:precision binary64
(if (<= m -53.0)
(exp (* -0.25 (pow m 2.0)))
(if (<= m 1.12e-237)
(* (cos M) (exp (* M n)))
(* (cos M) (exp (* n (* m -0.5)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -53.0) {
tmp = exp((-0.25 * pow(m, 2.0)));
} else if (m <= 1.12e-237) {
tmp = cos(M) * exp((M * n));
} else {
tmp = cos(M) * exp((n * (m * -0.5)));
}
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 <= (-53.0d0)) then
tmp = exp(((-0.25d0) * (m ** 2.0d0)))
else if (m <= 1.12d-237) then
tmp = cos(m_1) * exp((m_1 * n))
else
tmp = cos(m_1) * exp((n * (m * (-0.5d0))))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -53.0) {
tmp = Math.exp((-0.25 * Math.pow(m, 2.0)));
} else if (m <= 1.12e-237) {
tmp = Math.cos(M) * Math.exp((M * n));
} else {
tmp = Math.cos(M) * Math.exp((n * (m * -0.5)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -53.0: tmp = math.exp((-0.25 * math.pow(m, 2.0))) elif m <= 1.12e-237: tmp = math.cos(M) * math.exp((M * n)) else: tmp = math.cos(M) * math.exp((n * (m * -0.5))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -53.0) tmp = exp(Float64(-0.25 * (m ^ 2.0))); elseif (m <= 1.12e-237) tmp = Float64(cos(M) * exp(Float64(M * n))); else tmp = Float64(cos(M) * exp(Float64(n * Float64(m * -0.5)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -53.0) tmp = exp((-0.25 * (m ^ 2.0))); elseif (m <= 1.12e-237) tmp = cos(M) * exp((M * n)); else tmp = cos(M) * exp((n * (m * -0.5))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -53.0], N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[m, 1.12e-237], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(n * N[(m * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -53:\\
\;\;\;\;e^{-0.25 \cdot {m}^{2}}\\
\mathbf{elif}\;m \leq 1.12 \cdot 10^{-237}:\\
\;\;\;\;\cos M \cdot e^{M \cdot n}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{n \cdot \left(m \cdot -0.5\right)}\\
\end{array}
\end{array}
if m < -53Initial program 75.4%
Taylor expanded in K around 0 98.2%
cos-neg98.2%
Simplified98.2%
Taylor expanded in n around 0 82.5%
+-commutative82.5%
unpow282.5%
distribute-rgt-out93.1%
*-commutative93.1%
*-commutative93.1%
Simplified93.1%
Taylor expanded in m around inf 98.3%
*-commutative98.3%
Simplified98.3%
Taylor expanded in M around 0 98.3%
if -53 < m < 1.12000000000000002e-237Initial program 83.1%
Taylor expanded in K around 0 96.9%
cos-neg96.9%
Simplified96.9%
Taylor expanded in n around 0 72.6%
+-commutative72.6%
unpow272.6%
distribute-rgt-out74.2%
*-commutative74.2%
*-commutative74.2%
Simplified74.2%
Taylor expanded in n around inf 37.0%
Taylor expanded in M around inf 37.0%
if 1.12000000000000002e-237 < m Initial program 77.5%
Taylor expanded in K around 0 97.2%
cos-neg97.2%
Simplified97.2%
Taylor expanded in n around 0 72.8%
+-commutative72.8%
unpow272.8%
distribute-rgt-out83.3%
*-commutative83.3%
*-commutative83.3%
Simplified83.3%
Taylor expanded in n around inf 35.5%
Taylor expanded in M around 0 28.4%
associate-*r*28.4%
*-commutative28.4%
Simplified28.4%
Final simplification46.1%
(FPCore (K m n M l) :precision binary64 (if (or (<= m -55.0) (not (<= m 53.0))) (exp (* -0.25 (pow m 2.0))) (* (cos M) (exp (* M n)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((m <= -55.0) || !(m <= 53.0)) {
tmp = exp((-0.25 * pow(m, 2.0)));
} else {
tmp = cos(M) * exp((M * 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 <= (-55.0d0)) .or. (.not. (m <= 53.0d0))) then
tmp = exp(((-0.25d0) * (m ** 2.0d0)))
else
tmp = cos(m_1) * exp((m_1 * 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 <= -55.0) || !(m <= 53.0)) {
tmp = Math.exp((-0.25 * Math.pow(m, 2.0)));
} else {
tmp = Math.cos(M) * Math.exp((M * n));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (m <= -55.0) or not (m <= 53.0): tmp = math.exp((-0.25 * math.pow(m, 2.0))) else: tmp = math.cos(M) * math.exp((M * n)) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((m <= -55.0) || !(m <= 53.0)) tmp = exp(Float64(-0.25 * (m ^ 2.0))); else tmp = Float64(cos(M) * exp(Float64(M * n))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((m <= -55.0) || ~((m <= 53.0))) tmp = exp((-0.25 * (m ^ 2.0))); else tmp = cos(M) * exp((M * n)); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[m, -55.0], N[Not[LessEqual[m, 53.0]], $MachinePrecision]], N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -55 \lor \neg \left(m \leq 53\right):\\
\;\;\;\;e^{-0.25 \cdot {m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{M \cdot n}\\
\end{array}
\end{array}
if m < -55 or 53 < m Initial program 72.8%
Taylor expanded in K around 0 99.3%
cos-neg99.3%
Simplified99.3%
Taylor expanded in n around 0 77.3%
+-commutative77.3%
unpow277.3%
distribute-rgt-out89.9%
*-commutative89.9%
*-commutative89.9%
Simplified89.9%
Taylor expanded in m around inf 97.8%
*-commutative97.8%
Simplified97.8%
Taylor expanded in M around 0 97.8%
if -55 < m < 53Initial program 84.8%
Taylor expanded in K around 0 95.2%
cos-neg95.2%
Simplified95.2%
Taylor expanded in n around 0 72.2%
+-commutative72.2%
unpow272.2%
distribute-rgt-out75.5%
*-commutative75.5%
*-commutative75.5%
Simplified75.5%
Taylor expanded in n around inf 35.5%
Taylor expanded in M around inf 34.7%
Final simplification68.2%
(FPCore (K m n M l) :precision binary64 (exp (* -0.25 (pow m 2.0))))
double code(double K, double m, double n, double M, double l) {
return exp((-0.25 * pow(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(((-0.25d0) * (m ** 2.0d0)))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.exp((-0.25 * Math.pow(m, 2.0)));
}
def code(K, m, n, M, l): return math.exp((-0.25 * math.pow(m, 2.0)))
function code(K, m, n, M, l) return exp(Float64(-0.25 * (m ^ 2.0))) end
function tmp = code(K, m, n, M, l) tmp = exp((-0.25 * (m ^ 2.0))); end
code[K_, m_, n_, M_, l_] := N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{-0.25 \cdot {m}^{2}}
\end{array}
Initial program 78.4%
Taylor expanded in K around 0 97.4%
cos-neg97.4%
Simplified97.4%
Taylor expanded in n around 0 74.9%
+-commutative74.9%
unpow274.9%
distribute-rgt-out83.1%
*-commutative83.1%
*-commutative83.1%
Simplified83.1%
Taylor expanded in m around inf 57.1%
*-commutative57.1%
Simplified57.1%
Taylor expanded in M around 0 57.0%
Final simplification57.0%
herbie shell --seed 2024076
(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)))))))