
(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 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (K m n M l) :precision binary64 (* (cos (- (/ (* K (+ m n)) 2.0) M)) (exp (- (- (pow (- (/ (+ m n) 2.0) M) 2.0)) (- l (fabs (- m n)))))))
double code(double K, double m, double n, double M, double l) {
return cos((((K * (m + n)) / 2.0) - M)) * exp((-pow((((m + n) / 2.0) - M), 2.0) - (l - fabs((m - n)))));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos((((k * (m + n)) / 2.0d0) - m_1)) * exp((-((((m + n) / 2.0d0) - m_1) ** 2.0d0) - (l - abs((m - n)))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos((((K * (m + n)) / 2.0) - M)) * Math.exp((-Math.pow((((m + n) / 2.0) - M), 2.0) - (l - Math.abs((m - n)))));
}
def code(K, m, n, M, l): return math.cos((((K * (m + n)) / 2.0) - M)) * math.exp((-math.pow((((m + n) / 2.0) - M), 2.0) - (l - math.fabs((m - n)))))
function code(K, m, n, M, l) return Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * exp(Float64(Float64(-(Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)) - Float64(l - abs(Float64(m - n)))))) end
function tmp = code(K, m, n, M, l) tmp = cos((((K * (m + n)) / 2.0) - M)) * exp((-((((m + n) / 2.0) - M) ^ 2.0) - (l - abs((m - n))))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[((-N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]) - N[(l - N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}
\end{array}
(FPCore (K m n M l) :precision binary64 (* (cos M) (exp (- (- (fabs (- m n)) l) (pow (- (/ (+ m n) 2.0) M) 2.0)))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp(((fabs((m - n)) - l) - pow((((m + n) / 2.0) - M), 2.0)));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos(m_1) * exp(((abs((m - n)) - l) - ((((m + n) / 2.0d0) - m_1) ** 2.0d0)))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.exp(((Math.abs((m - n)) - l) - Math.pow((((m + n) / 2.0) - M), 2.0)));
}
def code(K, m, n, M, l): return math.cos(M) * math.exp(((math.fabs((m - n)) - l) - math.pow((((m + n) / 2.0) - M), 2.0)))
function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(Float64(abs(Float64(m - n)) - l) - (Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * exp(((abs((m - n)) - l) - ((((m + n) / 2.0) - M) ^ 2.0))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{\left(\left|m - n\right| - \ell\right) - {\left(\frac{m + n}{2} - M\right)}^{2}}
\end{array}
Initial program 76.7%
*-commutative76.7%
associate-*r/76.7%
associate--r-76.7%
+-commutative76.7%
associate-+r-76.7%
unsub-neg76.7%
associate--r+76.7%
+-commutative76.7%
associate--r+76.7%
Simplified76.7%
Taylor expanded in K around 0 98.2%
cos-neg98.2%
Simplified98.2%
Final simplification98.2%
(FPCore (K m n M l)
:precision binary64
(if (<= n 3.4e-192)
(* (cos M) (exp (* (* m m) -0.25)))
(if (<= n 2.5e-10)
(* (cos M) (exp (- (- (fabs (- m n)) l) (* M M))))
(* (cos M) (exp (* -0.25 (* n n)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 3.4e-192) {
tmp = cos(M) * exp(((m * m) * -0.25));
} else if (n <= 2.5e-10) {
tmp = cos(M) * exp(((fabs((m - n)) - l) - (M * M)));
} else {
tmp = cos(M) * exp((-0.25 * (n * n)));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (n <= 3.4d-192) then
tmp = cos(m_1) * exp(((m * m) * (-0.25d0)))
else if (n <= 2.5d-10) then
tmp = cos(m_1) * exp(((abs((m - n)) - l) - (m_1 * m_1)))
else
tmp = cos(m_1) * exp(((-0.25d0) * (n * n)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 3.4e-192) {
tmp = Math.cos(M) * Math.exp(((m * m) * -0.25));
} else if (n <= 2.5e-10) {
tmp = Math.cos(M) * Math.exp(((Math.abs((m - n)) - l) - (M * M)));
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * (n * n)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 3.4e-192: tmp = math.cos(M) * math.exp(((m * m) * -0.25)) elif n <= 2.5e-10: tmp = math.cos(M) * math.exp(((math.fabs((m - n)) - l) - (M * M))) else: tmp = math.cos(M) * math.exp((-0.25 * (n * n))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 3.4e-192) tmp = Float64(cos(M) * exp(Float64(Float64(m * m) * -0.25))); elseif (n <= 2.5e-10) tmp = Float64(cos(M) * exp(Float64(Float64(abs(Float64(m - n)) - l) - Float64(M * M)))); else tmp = Float64(cos(M) * exp(Float64(-0.25 * Float64(n * n)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 3.4e-192) tmp = cos(M) * exp(((m * m) * -0.25)); elseif (n <= 2.5e-10) tmp = cos(M) * exp(((abs((m - n)) - l) - (M * M))); else tmp = cos(M) * exp((-0.25 * (n * n))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 3.4e-192], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.5e-10], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 3.4 \cdot 10^{-192}:\\
\;\;\;\;\cos M \cdot e^{\left(m \cdot m\right) \cdot -0.25}\\
\mathbf{elif}\;n \leq 2.5 \cdot 10^{-10}:\\
\;\;\;\;\cos M \cdot e^{\left(\left|m - n\right| - \ell\right) - M \cdot M}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(n \cdot n\right)}\\
\end{array}
\end{array}
if n < 3.40000000000000002e-192Initial program 77.7%
*-commutative77.7%
associate-*r/77.7%
associate--r-77.7%
+-commutative77.7%
associate-+r-77.7%
unsub-neg77.7%
associate--r+77.7%
+-commutative77.7%
associate--r+77.7%
Simplified77.7%
Taylor expanded in K around 0 98.7%
cos-neg98.7%
Simplified98.7%
Taylor expanded in m around inf 59.6%
*-commutative59.6%
unpow259.6%
Simplified59.6%
if 3.40000000000000002e-192 < n < 2.50000000000000016e-10Initial program 77.7%
*-commutative77.7%
associate-*r/77.7%
associate--r-77.7%
+-commutative77.7%
associate-+r-77.7%
unsub-neg77.7%
associate--r+77.7%
+-commutative77.7%
associate--r+77.7%
Simplified77.7%
Taylor expanded in K around 0 98.4%
cos-neg98.4%
Simplified98.4%
Taylor expanded in M around inf 73.7%
unpow273.7%
Simplified73.7%
if 2.50000000000000016e-10 < n Initial program 74.3%
*-commutative74.3%
associate-*r/74.3%
associate--r-74.3%
+-commutative74.3%
associate-+r-74.3%
unsub-neg74.3%
associate--r+74.3%
+-commutative74.3%
associate--r+74.3%
Simplified74.3%
Taylor expanded in K around 0 97.3%
cos-neg97.3%
Simplified97.3%
Taylor expanded in n around inf 90.7%
*-commutative90.7%
unpow290.7%
Simplified90.7%
Final simplification71.1%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (cos M) (exp (* M (- M)))))
(t_1 (* (cos M) (exp (* (* m m) -0.25)))))
(if (<= m -54.0)
t_1
(if (<= m -3.8e-194)
t_0
(if (<= m -3.35e-302)
(/ (cos M) (exp l))
(if (<= m 4.2e-125)
t_0
(if (<= m 5.2e-96)
(* 0.5 (* (* K (* M m)) (exp (- l))))
(if (<= m 1.02e-13) t_0 t_1))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(M) * exp((M * -M));
double t_1 = cos(M) * exp(((m * m) * -0.25));
double tmp;
if (m <= -54.0) {
tmp = t_1;
} else if (m <= -3.8e-194) {
tmp = t_0;
} else if (m <= -3.35e-302) {
tmp = cos(M) / exp(l);
} else if (m <= 4.2e-125) {
tmp = t_0;
} else if (m <= 5.2e-96) {
tmp = 0.5 * ((K * (M * m)) * exp(-l));
} else if (m <= 1.02e-13) {
tmp = t_0;
} else {
tmp = t_1;
}
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 = cos(m_1) * exp((m_1 * -m_1))
t_1 = cos(m_1) * exp(((m * m) * (-0.25d0)))
if (m <= (-54.0d0)) then
tmp = t_1
else if (m <= (-3.8d-194)) then
tmp = t_0
else if (m <= (-3.35d-302)) then
tmp = cos(m_1) / exp(l)
else if (m <= 4.2d-125) then
tmp = t_0
else if (m <= 5.2d-96) then
tmp = 0.5d0 * ((k * (m_1 * m)) * exp(-l))
else if (m <= 1.02d-13) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.cos(M) * Math.exp((M * -M));
double t_1 = Math.cos(M) * Math.exp(((m * m) * -0.25));
double tmp;
if (m <= -54.0) {
tmp = t_1;
} else if (m <= -3.8e-194) {
tmp = t_0;
} else if (m <= -3.35e-302) {
tmp = Math.cos(M) / Math.exp(l);
} else if (m <= 4.2e-125) {
tmp = t_0;
} else if (m <= 5.2e-96) {
tmp = 0.5 * ((K * (M * m)) * Math.exp(-l));
} else if (m <= 1.02e-13) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(M) * math.exp((M * -M)) t_1 = math.cos(M) * math.exp(((m * m) * -0.25)) tmp = 0 if m <= -54.0: tmp = t_1 elif m <= -3.8e-194: tmp = t_0 elif m <= -3.35e-302: tmp = math.cos(M) / math.exp(l) elif m <= 4.2e-125: tmp = t_0 elif m <= 5.2e-96: tmp = 0.5 * ((K * (M * m)) * math.exp(-l)) elif m <= 1.02e-13: tmp = t_0 else: tmp = t_1 return tmp
function code(K, m, n, M, l) t_0 = Float64(cos(M) * exp(Float64(M * Float64(-M)))) t_1 = Float64(cos(M) * exp(Float64(Float64(m * m) * -0.25))) tmp = 0.0 if (m <= -54.0) tmp = t_1; elseif (m <= -3.8e-194) tmp = t_0; elseif (m <= -3.35e-302) tmp = Float64(cos(M) / exp(l)); elseif (m <= 4.2e-125) tmp = t_0; elseif (m <= 5.2e-96) tmp = Float64(0.5 * Float64(Float64(K * Float64(M * m)) * exp(Float64(-l)))); elseif (m <= 1.02e-13) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(M) * exp((M * -M)); t_1 = cos(M) * exp(((m * m) * -0.25)); tmp = 0.0; if (m <= -54.0) tmp = t_1; elseif (m <= -3.8e-194) tmp = t_0; elseif (m <= -3.35e-302) tmp = cos(M) / exp(l); elseif (m <= 4.2e-125) tmp = t_0; elseif (m <= 5.2e-96) tmp = 0.5 * ((K * (M * m)) * exp(-l)); elseif (m <= 1.02e-13) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * (-M)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -54.0], t$95$1, If[LessEqual[m, -3.8e-194], t$95$0, If[LessEqual[m, -3.35e-302], N[(N[Cos[M], $MachinePrecision] / N[Exp[l], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 4.2e-125], t$95$0, If[LessEqual[m, 5.2e-96], N[(0.5 * N[(N[(K * N[(M * m), $MachinePrecision]), $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.02e-13], t$95$0, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos M \cdot e^{M \cdot \left(-M\right)}\\
t_1 := \cos M \cdot e^{\left(m \cdot m\right) \cdot -0.25}\\
\mathbf{if}\;m \leq -54:\\
\;\;\;\;t_1\\
\mathbf{elif}\;m \leq -3.8 \cdot 10^{-194}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;m \leq -3.35 \cdot 10^{-302}:\\
\;\;\;\;\frac{\cos M}{e^{\ell}}\\
\mathbf{elif}\;m \leq 4.2 \cdot 10^{-125}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;m \leq 5.2 \cdot 10^{-96}:\\
\;\;\;\;0.5 \cdot \left(\left(K \cdot \left(M \cdot m\right)\right) \cdot e^{-\ell}\right)\\
\mathbf{elif}\;m \leq 1.02 \cdot 10^{-13}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if m < -54 or 1.0199999999999999e-13 < m Initial program 65.6%
*-commutative65.6%
associate-*r/65.6%
associate--r-65.6%
+-commutative65.6%
associate-+r-65.6%
unsub-neg65.6%
associate--r+65.6%
+-commutative65.6%
associate--r+65.6%
Simplified65.6%
Taylor expanded in K around 0 99.2%
cos-neg99.2%
Simplified99.2%
Taylor expanded in m around inf 96.2%
*-commutative96.2%
unpow296.2%
Simplified96.2%
if -54 < m < -3.8000000000000003e-194 or -3.35000000000000021e-302 < m < 4.2e-125 or 5.2000000000000003e-96 < m < 1.0199999999999999e-13Initial program 87.8%
*-commutative87.8%
associate-*r/87.8%
associate--r-87.8%
+-commutative87.8%
associate-+r-87.8%
unsub-neg87.8%
associate--r+87.8%
+-commutative87.8%
associate--r+87.8%
Simplified87.8%
Taylor expanded in K around 0 96.3%
cos-neg96.3%
Simplified96.3%
Taylor expanded in M around inf 57.5%
mul-1-neg57.5%
unpow257.5%
distribute-rgt-neg-in57.5%
Simplified57.5%
if -3.8000000000000003e-194 < m < -3.35000000000000021e-302Initial program 84.6%
*-commutative84.6%
associate-*r/84.6%
associate--r-84.6%
+-commutative84.6%
associate-+r-84.6%
unsub-neg84.6%
associate--r+84.6%
+-commutative84.6%
associate--r+84.6%
Simplified84.6%
Taylor expanded in l around inf 51.0%
neg-mul-151.0%
Simplified51.0%
Taylor expanded in K around 0 54.9%
cos-neg54.9%
sin-neg54.9%
Simplified54.9%
Taylor expanded in K around 0 58.9%
exp-neg58.9%
associate-*l/58.9%
*-lft-identity58.9%
Simplified58.9%
if 4.2e-125 < m < 5.2000000000000003e-96Initial program 100.0%
*-commutative100.0%
associate-*r/100.0%
associate--r-100.0%
+-commutative100.0%
associate-+r-100.0%
unsub-neg100.0%
associate--r+100.0%
+-commutative100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in l around inf 58.3%
neg-mul-158.3%
Simplified58.3%
Taylor expanded in K around 0 58.1%
cos-neg58.1%
sin-neg58.1%
Simplified58.1%
Taylor expanded in M around 0 58.0%
Taylor expanded in m around inf 44.0%
*-commutative44.0%
*-commutative44.0%
Simplified44.0%
Final simplification76.6%
(FPCore (K m n M l)
:precision binary64
(if (<= n 3.2e-184)
(* (cos M) (exp (* (* m m) -0.25)))
(if (<= n 54.0)
(* (cos M) (exp (* M (- M))))
(* (cos M) (exp (* -0.25 (* n n)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 3.2e-184) {
tmp = cos(M) * exp(((m * m) * -0.25));
} else if (n <= 54.0) {
tmp = cos(M) * exp((M * -M));
} else {
tmp = cos(M) * exp((-0.25 * (n * n)));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (n <= 3.2d-184) then
tmp = cos(m_1) * exp(((m * m) * (-0.25d0)))
else if (n <= 54.0d0) then
tmp = cos(m_1) * exp((m_1 * -m_1))
else
tmp = cos(m_1) * exp(((-0.25d0) * (n * n)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 3.2e-184) {
tmp = Math.cos(M) * Math.exp(((m * m) * -0.25));
} else if (n <= 54.0) {
tmp = Math.cos(M) * Math.exp((M * -M));
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * (n * n)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 3.2e-184: tmp = math.cos(M) * math.exp(((m * m) * -0.25)) elif n <= 54.0: tmp = math.cos(M) * math.exp((M * -M)) else: tmp = math.cos(M) * math.exp((-0.25 * (n * n))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 3.2e-184) tmp = Float64(cos(M) * exp(Float64(Float64(m * m) * -0.25))); elseif (n <= 54.0) tmp = Float64(cos(M) * exp(Float64(M * Float64(-M)))); else tmp = Float64(cos(M) * exp(Float64(-0.25 * Float64(n * n)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 3.2e-184) tmp = cos(M) * exp(((m * m) * -0.25)); elseif (n <= 54.0) tmp = cos(M) * exp((M * -M)); else tmp = cos(M) * exp((-0.25 * (n * n))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 3.2e-184], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 54.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * (-M)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 3.2 \cdot 10^{-184}:\\
\;\;\;\;\cos M \cdot e^{\left(m \cdot m\right) \cdot -0.25}\\
\mathbf{elif}\;n \leq 54:\\
\;\;\;\;\cos M \cdot e^{M \cdot \left(-M\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(n \cdot n\right)}\\
\end{array}
\end{array}
if n < 3.2e-184Initial program 77.1%
*-commutative77.1%
associate-*r/77.1%
associate--r-77.1%
+-commutative77.1%
associate-+r-77.1%
unsub-neg77.1%
associate--r+77.1%
+-commutative77.1%
associate--r+77.1%
Simplified77.1%
Taylor expanded in K around 0 98.7%
cos-neg98.7%
Simplified98.7%
Taylor expanded in m around inf 59.9%
*-commutative59.9%
unpow259.9%
Simplified59.9%
if 3.2e-184 < n < 54Initial program 78.2%
*-commutative78.2%
associate-*r/78.2%
associate--r-78.2%
+-commutative78.2%
associate-+r-78.2%
unsub-neg78.2%
associate--r+78.2%
+-commutative78.2%
associate--r+78.2%
Simplified78.2%
Taylor expanded in K around 0 98.4%
cos-neg98.4%
Simplified98.4%
Taylor expanded in M around inf 59.5%
mul-1-neg59.5%
unpow259.5%
distribute-rgt-neg-in59.5%
Simplified59.5%
if 54 < n Initial program 75.0%
*-commutative75.0%
associate-*r/75.0%
associate--r-75.0%
+-commutative75.0%
associate-+r-75.0%
unsub-neg75.0%
associate--r+75.0%
+-commutative75.0%
associate--r+75.0%
Simplified75.0%
Taylor expanded in K around 0 97.2%
cos-neg97.2%
Simplified97.2%
Taylor expanded in n around inf 93.2%
*-commutative93.2%
unpow293.2%
Simplified93.2%
Final simplification69.2%
(FPCore (K m n M l) :precision binary64 (if (or (<= M -1300000000000.0) (not (<= M 7000000000.0))) (* (cos M) (exp (* M (- M)))) (* (cos M) (exp (- l)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((M <= -1300000000000.0) || !(M <= 7000000000.0)) {
tmp = cos(M) * exp((M * -M));
} 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 ((m_1 <= (-1300000000000.0d0)) .or. (.not. (m_1 <= 7000000000.0d0))) then
tmp = cos(m_1) * exp((m_1 * -m_1))
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 ((M <= -1300000000000.0) || !(M <= 7000000000.0)) {
tmp = Math.cos(M) * Math.exp((M * -M));
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (M <= -1300000000000.0) or not (M <= 7000000000.0): tmp = math.cos(M) * math.exp((M * -M)) else: tmp = math.cos(M) * math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((M <= -1300000000000.0) || !(M <= 7000000000.0)) tmp = Float64(cos(M) * exp(Float64(M * Float64(-M)))); else tmp = Float64(cos(M) * exp(Float64(-l))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((M <= -1300000000000.0) || ~((M <= 7000000000.0))) tmp = cos(M) * exp((M * -M)); else tmp = cos(M) * exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[M, -1300000000000.0], N[Not[LessEqual[M, 7000000000.0]], $MachinePrecision]], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * (-M)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq -1300000000000 \lor \neg \left(M \leq 7000000000\right):\\
\;\;\;\;\cos M \cdot e^{M \cdot \left(-M\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if M < -1.3e12 or 7e9 < M Initial program 75.2%
*-commutative75.2%
associate-*r/75.2%
associate--r-75.2%
+-commutative75.2%
associate-+r-75.2%
unsub-neg75.2%
associate--r+75.2%
+-commutative75.2%
associate--r+75.2%
Simplified75.2%
Taylor expanded in K around 0 99.2%
cos-neg99.2%
Simplified99.2%
Taylor expanded in M around inf 97.6%
mul-1-neg97.6%
unpow297.6%
distribute-rgt-neg-in97.6%
Simplified97.6%
if -1.3e12 < M < 7e9Initial program 78.2%
*-commutative78.2%
associate-*r/78.2%
associate--r-78.2%
+-commutative78.2%
associate-+r-78.2%
unsub-neg78.2%
associate--r+78.2%
+-commutative78.2%
associate--r+78.2%
Simplified78.2%
Taylor expanded in l around inf 40.8%
neg-mul-140.8%
Simplified40.8%
Taylor expanded in K around 0 49.5%
cos-neg49.5%
*-commutative49.5%
Simplified49.5%
Final simplification73.0%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (exp (- l))))
(if (<= m -5500.0)
(* 0.5 (* t_0 (* n (* M K))))
(if (<= m -1.7e-293)
(* (cos M) t_0)
(if (<= m 1.3e-94) (* (* M (* m K)) (/ 0.5 (exp l))) t_0)))))
double code(double K, double m, double n, double M, double l) {
double t_0 = exp(-l);
double tmp;
if (m <= -5500.0) {
tmp = 0.5 * (t_0 * (n * (M * K)));
} else if (m <= -1.7e-293) {
tmp = cos(M) * t_0;
} else if (m <= 1.3e-94) {
tmp = (M * (m * K)) * (0.5 / 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(-l)
if (m <= (-5500.0d0)) then
tmp = 0.5d0 * (t_0 * (n * (m_1 * k)))
else if (m <= (-1.7d-293)) then
tmp = cos(m_1) * t_0
else if (m <= 1.3d-94) then
tmp = (m_1 * (m * k)) * (0.5d0 / 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(-l);
double tmp;
if (m <= -5500.0) {
tmp = 0.5 * (t_0 * (n * (M * K)));
} else if (m <= -1.7e-293) {
tmp = Math.cos(M) * t_0;
} else if (m <= 1.3e-94) {
tmp = (M * (m * K)) * (0.5 / Math.exp(l));
} else {
tmp = t_0;
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.exp(-l) tmp = 0 if m <= -5500.0: tmp = 0.5 * (t_0 * (n * (M * K))) elif m <= -1.7e-293: tmp = math.cos(M) * t_0 elif m <= 1.3e-94: tmp = (M * (m * K)) * (0.5 / math.exp(l)) else: tmp = t_0 return tmp
function code(K, m, n, M, l) t_0 = exp(Float64(-l)) tmp = 0.0 if (m <= -5500.0) tmp = Float64(0.5 * Float64(t_0 * Float64(n * Float64(M * K)))); elseif (m <= -1.7e-293) tmp = Float64(cos(M) * t_0); elseif (m <= 1.3e-94) tmp = Float64(Float64(M * Float64(m * K)) * Float64(0.5 / exp(l))); else tmp = t_0; end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = exp(-l); tmp = 0.0; if (m <= -5500.0) tmp = 0.5 * (t_0 * (n * (M * K))); elseif (m <= -1.7e-293) tmp = cos(M) * t_0; elseif (m <= 1.3e-94) tmp = (M * (m * K)) * (0.5 / exp(l)); else tmp = t_0; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[(-l)], $MachinePrecision]}, If[LessEqual[m, -5500.0], N[(0.5 * N[(t$95$0 * N[(n * N[(M * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, -1.7e-293], N[(N[Cos[M], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[m, 1.3e-94], N[(N[(M * N[(m * K), $MachinePrecision]), $MachinePrecision] * N[(0.5 / N[Exp[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\ell}\\
\mathbf{if}\;m \leq -5500:\\
\;\;\;\;0.5 \cdot \left(t_0 \cdot \left(n \cdot \left(M \cdot K\right)\right)\right)\\
\mathbf{elif}\;m \leq -1.7 \cdot 10^{-293}:\\
\;\;\;\;\cos M \cdot t_0\\
\mathbf{elif}\;m \leq 1.3 \cdot 10^{-94}:\\
\;\;\;\;\left(M \cdot \left(m \cdot K\right)\right) \cdot \frac{0.5}{e^{\ell}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if m < -5500Initial program 74.1%
*-commutative74.1%
associate-*r/74.1%
associate--r-74.1%
+-commutative74.1%
associate-+r-74.1%
unsub-neg74.1%
associate--r+74.1%
+-commutative74.1%
associate--r+74.1%
Simplified74.1%
Taylor expanded in l around inf 18.7%
neg-mul-118.7%
Simplified18.7%
Taylor expanded in K around 0 22.3%
cos-neg22.3%
sin-neg22.3%
Simplified22.3%
Taylor expanded in M around 0 11.9%
Taylor expanded in n around inf 37.5%
if -5500 < m < -1.7e-293Initial program 84.6%
*-commutative84.6%
associate-*r/84.6%
associate--r-84.6%
+-commutative84.6%
associate-+r-84.6%
unsub-neg84.6%
associate--r+84.6%
+-commutative84.6%
associate--r+84.6%
Simplified84.6%
Taylor expanded in l around inf 42.7%
neg-mul-142.7%
Simplified42.7%
Taylor expanded in K around 0 49.1%
cos-neg49.1%
*-commutative49.1%
Simplified49.1%
if -1.7e-293 < m < 1.29999999999999997e-94Initial program 97.5%
*-commutative97.5%
associate-*r/97.5%
associate--r-97.5%
+-commutative97.5%
associate-+r-97.5%
unsub-neg97.5%
associate--r+97.5%
+-commutative97.5%
associate--r+97.5%
Simplified97.5%
Taylor expanded in l around inf 56.1%
neg-mul-156.1%
Simplified56.1%
Taylor expanded in K around 0 56.1%
cos-neg56.1%
sin-neg56.1%
Simplified56.1%
Taylor expanded in M around 0 53.5%
Taylor expanded in m around inf 37.0%
associate-*r*37.0%
*-commutative37.0%
*-commutative37.0%
*-commutative37.0%
associate-*l*41.7%
exp-neg41.7%
associate-*r/41.7%
metadata-eval41.7%
Simplified41.7%
if 1.29999999999999997e-94 < m Initial program 63.8%
*-commutative63.8%
associate-*r/63.8%
associate--r-63.8%
+-commutative63.8%
associate-+r-63.8%
unsub-neg63.8%
associate--r+63.8%
+-commutative63.8%
associate--r+63.8%
Simplified63.8%
Taylor expanded in l around inf 20.7%
neg-mul-120.7%
Simplified20.7%
Taylor expanded in K around 0 23.7%
cos-neg23.7%
sin-neg23.7%
Simplified23.7%
Taylor expanded in M around 0 32.1%
Final simplification39.1%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (exp (- l))))
(if (<= m -7500.0)
(* 0.5 (* t_0 (* n (* M K))))
(if (<= m -2.8e-293)
(/ (cos M) (exp l))
(if (<= m 5.3e-96) (* (* M (* m K)) (/ 0.5 (exp l))) t_0)))))
double code(double K, double m, double n, double M, double l) {
double t_0 = exp(-l);
double tmp;
if (m <= -7500.0) {
tmp = 0.5 * (t_0 * (n * (M * K)));
} else if (m <= -2.8e-293) {
tmp = cos(M) / exp(l);
} else if (m <= 5.3e-96) {
tmp = (M * (m * K)) * (0.5 / 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(-l)
if (m <= (-7500.0d0)) then
tmp = 0.5d0 * (t_0 * (n * (m_1 * k)))
else if (m <= (-2.8d-293)) then
tmp = cos(m_1) / exp(l)
else if (m <= 5.3d-96) then
tmp = (m_1 * (m * k)) * (0.5d0 / 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(-l);
double tmp;
if (m <= -7500.0) {
tmp = 0.5 * (t_0 * (n * (M * K)));
} else if (m <= -2.8e-293) {
tmp = Math.cos(M) / Math.exp(l);
} else if (m <= 5.3e-96) {
tmp = (M * (m * K)) * (0.5 / Math.exp(l));
} else {
tmp = t_0;
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.exp(-l) tmp = 0 if m <= -7500.0: tmp = 0.5 * (t_0 * (n * (M * K))) elif m <= -2.8e-293: tmp = math.cos(M) / math.exp(l) elif m <= 5.3e-96: tmp = (M * (m * K)) * (0.5 / math.exp(l)) else: tmp = t_0 return tmp
function code(K, m, n, M, l) t_0 = exp(Float64(-l)) tmp = 0.0 if (m <= -7500.0) tmp = Float64(0.5 * Float64(t_0 * Float64(n * Float64(M * K)))); elseif (m <= -2.8e-293) tmp = Float64(cos(M) / exp(l)); elseif (m <= 5.3e-96) tmp = Float64(Float64(M * Float64(m * K)) * Float64(0.5 / exp(l))); else tmp = t_0; end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = exp(-l); tmp = 0.0; if (m <= -7500.0) tmp = 0.5 * (t_0 * (n * (M * K))); elseif (m <= -2.8e-293) tmp = cos(M) / exp(l); elseif (m <= 5.3e-96) tmp = (M * (m * K)) * (0.5 / exp(l)); else tmp = t_0; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[(-l)], $MachinePrecision]}, If[LessEqual[m, -7500.0], N[(0.5 * N[(t$95$0 * N[(n * N[(M * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, -2.8e-293], N[(N[Cos[M], $MachinePrecision] / N[Exp[l], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 5.3e-96], N[(N[(M * N[(m * K), $MachinePrecision]), $MachinePrecision] * N[(0.5 / N[Exp[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\ell}\\
\mathbf{if}\;m \leq -7500:\\
\;\;\;\;0.5 \cdot \left(t_0 \cdot \left(n \cdot \left(M \cdot K\right)\right)\right)\\
\mathbf{elif}\;m \leq -2.8 \cdot 10^{-293}:\\
\;\;\;\;\frac{\cos M}{e^{\ell}}\\
\mathbf{elif}\;m \leq 5.3 \cdot 10^{-96}:\\
\;\;\;\;\left(M \cdot \left(m \cdot K\right)\right) \cdot \frac{0.5}{e^{\ell}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if m < -7500Initial program 74.1%
*-commutative74.1%
associate-*r/74.1%
associate--r-74.1%
+-commutative74.1%
associate-+r-74.1%
unsub-neg74.1%
associate--r+74.1%
+-commutative74.1%
associate--r+74.1%
Simplified74.1%
Taylor expanded in l around inf 18.7%
neg-mul-118.7%
Simplified18.7%
Taylor expanded in K around 0 22.3%
cos-neg22.3%
sin-neg22.3%
Simplified22.3%
Taylor expanded in M around 0 11.9%
Taylor expanded in n around inf 37.5%
if -7500 < m < -2.80000000000000025e-293Initial program 84.6%
*-commutative84.6%
associate-*r/84.6%
associate--r-84.6%
+-commutative84.6%
associate-+r-84.6%
unsub-neg84.6%
associate--r+84.6%
+-commutative84.6%
associate--r+84.6%
Simplified84.6%
Taylor expanded in l around inf 42.7%
neg-mul-142.7%
Simplified42.7%
Taylor expanded in K around 0 47.3%
cos-neg47.3%
sin-neg47.3%
Simplified47.3%
Taylor expanded in K around 0 49.1%
exp-neg49.1%
associate-*l/49.1%
*-lft-identity49.1%
Simplified49.1%
if -2.80000000000000025e-293 < m < 5.3000000000000001e-96Initial program 97.5%
*-commutative97.5%
associate-*r/97.5%
associate--r-97.5%
+-commutative97.5%
associate-+r-97.5%
unsub-neg97.5%
associate--r+97.5%
+-commutative97.5%
associate--r+97.5%
Simplified97.5%
Taylor expanded in l around inf 56.1%
neg-mul-156.1%
Simplified56.1%
Taylor expanded in K around 0 56.1%
cos-neg56.1%
sin-neg56.1%
Simplified56.1%
Taylor expanded in M around 0 53.5%
Taylor expanded in m around inf 37.0%
associate-*r*37.0%
*-commutative37.0%
*-commutative37.0%
*-commutative37.0%
associate-*l*41.7%
exp-neg41.7%
associate-*r/41.7%
metadata-eval41.7%
Simplified41.7%
if 5.3000000000000001e-96 < m Initial program 63.8%
*-commutative63.8%
associate-*r/63.8%
associate--r-63.8%
+-commutative63.8%
associate-+r-63.8%
unsub-neg63.8%
associate--r+63.8%
+-commutative63.8%
associate--r+63.8%
Simplified63.8%
Taylor expanded in l around inf 20.7%
neg-mul-120.7%
Simplified20.7%
Taylor expanded in K around 0 23.7%
cos-neg23.7%
sin-neg23.7%
Simplified23.7%
Taylor expanded in M around 0 32.1%
Final simplification39.1%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (exp (- l))))
(if (<= m -4200.0)
(* 0.5 (* t_0 (* n (* M K))))
(if (or (<= m -1.1e-291) (not (<= m 5.3e-96)))
t_0
(* (* M (* m K)) (/ 0.5 (exp l)))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = exp(-l);
double tmp;
if (m <= -4200.0) {
tmp = 0.5 * (t_0 * (n * (M * K)));
} else if ((m <= -1.1e-291) || !(m <= 5.3e-96)) {
tmp = t_0;
} else {
tmp = (M * (m * K)) * (0.5 / 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) :: t_0
real(8) :: tmp
t_0 = exp(-l)
if (m <= (-4200.0d0)) then
tmp = 0.5d0 * (t_0 * (n * (m_1 * k)))
else if ((m <= (-1.1d-291)) .or. (.not. (m <= 5.3d-96))) then
tmp = t_0
else
tmp = (m_1 * (m * k)) * (0.5d0 / exp(l))
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(-l);
double tmp;
if (m <= -4200.0) {
tmp = 0.5 * (t_0 * (n * (M * K)));
} else if ((m <= -1.1e-291) || !(m <= 5.3e-96)) {
tmp = t_0;
} else {
tmp = (M * (m * K)) * (0.5 / Math.exp(l));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.exp(-l) tmp = 0 if m <= -4200.0: tmp = 0.5 * (t_0 * (n * (M * K))) elif (m <= -1.1e-291) or not (m <= 5.3e-96): tmp = t_0 else: tmp = (M * (m * K)) * (0.5 / math.exp(l)) return tmp
function code(K, m, n, M, l) t_0 = exp(Float64(-l)) tmp = 0.0 if (m <= -4200.0) tmp = Float64(0.5 * Float64(t_0 * Float64(n * Float64(M * K)))); elseif ((m <= -1.1e-291) || !(m <= 5.3e-96)) tmp = t_0; else tmp = Float64(Float64(M * Float64(m * K)) * Float64(0.5 / exp(l))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = exp(-l); tmp = 0.0; if (m <= -4200.0) tmp = 0.5 * (t_0 * (n * (M * K))); elseif ((m <= -1.1e-291) || ~((m <= 5.3e-96))) tmp = t_0; else tmp = (M * (m * K)) * (0.5 / exp(l)); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[(-l)], $MachinePrecision]}, If[LessEqual[m, -4200.0], N[(0.5 * N[(t$95$0 * N[(n * N[(M * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[m, -1.1e-291], N[Not[LessEqual[m, 5.3e-96]], $MachinePrecision]], t$95$0, N[(N[(M * N[(m * K), $MachinePrecision]), $MachinePrecision] * N[(0.5 / N[Exp[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\ell}\\
\mathbf{if}\;m \leq -4200:\\
\;\;\;\;0.5 \cdot \left(t_0 \cdot \left(n \cdot \left(M \cdot K\right)\right)\right)\\
\mathbf{elif}\;m \leq -1.1 \cdot 10^{-291} \lor \neg \left(m \leq 5.3 \cdot 10^{-96}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left(M \cdot \left(m \cdot K\right)\right) \cdot \frac{0.5}{e^{\ell}}\\
\end{array}
\end{array}
if m < -4200Initial program 74.1%
*-commutative74.1%
associate-*r/74.1%
associate--r-74.1%
+-commutative74.1%
associate-+r-74.1%
unsub-neg74.1%
associate--r+74.1%
+-commutative74.1%
associate--r+74.1%
Simplified74.1%
Taylor expanded in l around inf 18.7%
neg-mul-118.7%
Simplified18.7%
Taylor expanded in K around 0 22.3%
cos-neg22.3%
sin-neg22.3%
Simplified22.3%
Taylor expanded in M around 0 11.9%
Taylor expanded in n around inf 37.5%
if -4200 < m < -1.10000000000000001e-291 or 5.3000000000000001e-96 < m Initial program 72.4%
*-commutative72.4%
associate-*r/72.4%
associate--r-72.4%
+-commutative72.4%
associate-+r-72.4%
unsub-neg72.4%
associate--r+72.4%
+-commutative72.4%
associate--r+72.4%
Simplified72.4%
Taylor expanded in l around inf 29.7%
neg-mul-129.7%
Simplified29.7%
Taylor expanded in K around 0 33.4%
cos-neg33.4%
sin-neg33.4%
Simplified33.4%
Taylor expanded in M around 0 39.1%
if -1.10000000000000001e-291 < m < 5.3000000000000001e-96Initial program 97.5%
*-commutative97.5%
associate-*r/97.5%
associate--r-97.5%
+-commutative97.5%
associate-+r-97.5%
unsub-neg97.5%
associate--r+97.5%
+-commutative97.5%
associate--r+97.5%
Simplified97.5%
Taylor expanded in l around inf 56.1%
neg-mul-156.1%
Simplified56.1%
Taylor expanded in K around 0 56.1%
cos-neg56.1%
sin-neg56.1%
Simplified56.1%
Taylor expanded in M around 0 53.5%
Taylor expanded in m around inf 37.0%
associate-*r*37.0%
*-commutative37.0%
*-commutative37.0%
*-commutative37.0%
associate-*l*41.7%
exp-neg41.7%
associate-*r/41.7%
metadata-eval41.7%
Simplified41.7%
Final simplification39.1%
(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(Float64(-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 \left(-M\right)
\end{array}
Initial program 76.7%
*-commutative76.7%
associate-*r/76.7%
associate--r-76.7%
+-commutative76.7%
associate-+r-76.7%
unsub-neg76.7%
associate--r+76.7%
+-commutative76.7%
associate--r+76.7%
Simplified76.7%
Taylor expanded in l around inf 31.4%
neg-mul-131.4%
Simplified31.4%
Taylor expanded in l around 0 9.8%
*-commutative9.8%
*-commutative9.8%
associate-*r*9.8%
*-commutative9.8%
*-commutative9.8%
+-commutative9.8%
*-commutative9.8%
Simplified9.8%
Taylor expanded in K around 0 10.5%
neg-mul-110.5%
Simplified10.5%
Final simplification10.5%
(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 76.7%
*-commutative76.7%
associate-*r/76.7%
associate--r-76.7%
+-commutative76.7%
associate-+r-76.7%
unsub-neg76.7%
associate--r+76.7%
+-commutative76.7%
associate--r+76.7%
Simplified76.7%
Taylor expanded in l around inf 31.4%
neg-mul-131.4%
Simplified31.4%
Taylor expanded in K around 0 34.4%
cos-neg34.4%
sin-neg34.4%
Simplified34.4%
Taylor expanded in M around 0 39.2%
Final simplification39.2%
(FPCore (K m n M l) :precision binary64 (+ 1.0 (* 0.5 (* K (* M (+ m n))))))
double code(double K, double m, double n, double M, double l) {
return 1.0 + (0.5 * (K * (M * (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 = 1.0d0 + (0.5d0 * (k * (m_1 * (m + n))))
end function
public static double code(double K, double m, double n, double M, double l) {
return 1.0 + (0.5 * (K * (M * (m + n))));
}
def code(K, m, n, M, l): return 1.0 + (0.5 * (K * (M * (m + n))))
function code(K, m, n, M, l) return Float64(1.0 + Float64(0.5 * Float64(K * Float64(M * Float64(m + n))))) end
function tmp = code(K, m, n, M, l) tmp = 1.0 + (0.5 * (K * (M * (m + n)))); end
code[K_, m_, n_, M_, l_] := N[(1.0 + N[(0.5 * N[(K * N[(M * N[(m + n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + 0.5 \cdot \left(K \cdot \left(M \cdot \left(m + n\right)\right)\right)
\end{array}
Initial program 76.7%
*-commutative76.7%
associate-*r/76.7%
associate--r-76.7%
+-commutative76.7%
associate-+r-76.7%
unsub-neg76.7%
associate--r+76.7%
+-commutative76.7%
associate--r+76.7%
Simplified76.7%
Taylor expanded in l around inf 31.4%
neg-mul-131.4%
Simplified31.4%
Taylor expanded in K around 0 34.4%
cos-neg34.4%
sin-neg34.4%
Simplified34.4%
Taylor expanded in M around 0 29.2%
Taylor expanded in l around 0 9.6%
Final simplification9.6%
herbie shell --seed 2023192
(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)))))))