
(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 14 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 75.6%
Taylor expanded in K around 0 97.1%
cos-neg97.1%
Simplified97.1%
Final simplification97.1%
(FPCore (K m n M l)
:precision binary64
(if (<= n 55.0)
(*
(cos M)
(exp (+ (* (- (* m 0.5) M) (- (- M (* m 0.5)) n)) (- (fabs (- m n)) l))))
(* (cos M) (exp (* (pow n 2.0) -0.25)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 55.0) {
tmp = cos(M) * exp(((((m * 0.5) - M) * ((M - (m * 0.5)) - n)) + (fabs((m - n)) - l)));
} else {
tmp = cos(M) * exp((pow(n, 2.0) * -0.25));
}
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 <= 55.0d0) 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(((n ** 2.0d0) * (-0.25d0)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 55.0) {
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((Math.pow(n, 2.0) * -0.25));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 55.0: 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((math.pow(n, 2.0) * -0.25)) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 55.0) 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(M) * exp(Float64((n ^ 2.0) * -0.25))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 55.0) tmp = cos(M) * exp(((((m * 0.5) - M) * ((M - (m * 0.5)) - n)) + (abs((m - n)) - l))); else tmp = cos(M) * exp(((n ^ 2.0) * -0.25)); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 55.0], 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[Power[n, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 55:\\
\;\;\;\;\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 M \cdot e^{{n}^{2} \cdot -0.25}\\
\end{array}
\end{array}
if n < 55Initial program 77.7%
Taylor expanded in K around 0 96.1%
cos-neg96.1%
Simplified96.1%
Taylor expanded in n around 0 76.8%
+-commutative64.1%
unpow264.1%
distribute-rgt-out68.4%
*-commutative68.4%
*-commutative68.4%
Simplified83.2%
if 55 < n Initial program 69.7%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification87.5%
(FPCore (K m n M l) :precision binary64 (if (<= n 55.0) (* (cos M) (exp (- (- (fabs (- m n)) l) (* 0.5 (* m (+ n (* m 0.5))))))) (* (cos M) (exp (* (pow n 2.0) -0.25)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 55.0) {
tmp = cos(M) * exp(((fabs((m - n)) - l) - (0.5 * (m * (n + (m * 0.5))))));
} else {
tmp = cos(M) * exp((pow(n, 2.0) * -0.25));
}
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 <= 55.0d0) then
tmp = cos(m_1) * exp(((abs((m - n)) - l) - (0.5d0 * (m * (n + (m * 0.5d0))))))
else
tmp = cos(m_1) * exp(((n ** 2.0d0) * (-0.25d0)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 55.0) {
tmp = Math.cos(M) * Math.exp(((Math.abs((m - n)) - l) - (0.5 * (m * (n + (m * 0.5))))));
} else {
tmp = Math.cos(M) * Math.exp((Math.pow(n, 2.0) * -0.25));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 55.0: tmp = math.cos(M) * math.exp(((math.fabs((m - n)) - l) - (0.5 * (m * (n + (m * 0.5)))))) else: tmp = math.cos(M) * math.exp((math.pow(n, 2.0) * -0.25)) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 55.0) tmp = Float64(cos(M) * exp(Float64(Float64(abs(Float64(m - n)) - l) - Float64(0.5 * Float64(m * Float64(n + Float64(m * 0.5))))))); else tmp = Float64(cos(M) * exp(Float64((n ^ 2.0) * -0.25))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 55.0) tmp = cos(M) * exp(((abs((m - n)) - l) - (0.5 * (m * (n + (m * 0.5)))))); else tmp = cos(M) * exp(((n ^ 2.0) * -0.25)); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 55.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[(0.5 * N[(m * N[(n + N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[Power[n, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 55:\\
\;\;\;\;\cos M \cdot e^{\left(\left|m - n\right| - \ell\right) - 0.5 \cdot \left(m \cdot \left(n + m \cdot 0.5\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{{n}^{2} \cdot -0.25}\\
\end{array}
\end{array}
if n < 55Initial program 77.7%
Taylor expanded in K around 0 96.1%
cos-neg96.1%
Simplified96.1%
Taylor expanded in n around 0 76.8%
+-commutative64.1%
unpow264.1%
distribute-rgt-out68.4%
*-commutative68.4%
*-commutative68.4%
Simplified83.2%
Taylor expanded in M around 0 67.8%
associate--r+67.8%
fabs-sub67.8%
*-commutative67.8%
Simplified67.8%
if 55 < n Initial program 69.7%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification76.1%
(FPCore (K m n M l) :precision binary64 (if (or (<= M -0.00135) (not (<= M 2.6e-42))) (* (cos M) (exp (- (pow M 2.0)))) (exp (- (fabs (- m n)) (+ l (* 0.5 (* m (+ n (* m 0.5)))))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((M <= -0.00135) || !(M <= 2.6e-42)) {
tmp = cos(M) * exp(-pow(M, 2.0));
} else {
tmp = exp((fabs((m - n)) - (l + (0.5 * (m * (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_1 <= (-0.00135d0)) .or. (.not. (m_1 <= 2.6d-42))) then
tmp = cos(m_1) * exp(-(m_1 ** 2.0d0))
else
tmp = exp((abs((m - n)) - (l + (0.5d0 * (m * (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 <= -0.00135) || !(M <= 2.6e-42)) {
tmp = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
} else {
tmp = Math.exp((Math.abs((m - n)) - (l + (0.5 * (m * (n + (m * 0.5)))))));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (M <= -0.00135) or not (M <= 2.6e-42): tmp = math.cos(M) * math.exp(-math.pow(M, 2.0)) else: tmp = math.exp((math.fabs((m - n)) - (l + (0.5 * (m * (n + (m * 0.5))))))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((M <= -0.00135) || !(M <= 2.6e-42)) tmp = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))); else tmp = exp(Float64(abs(Float64(m - n)) - Float64(l + Float64(0.5 * Float64(m * Float64(n + Float64(m * 0.5))))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((M <= -0.00135) || ~((M <= 2.6e-42))) tmp = cos(M) * exp(-(M ^ 2.0)); else tmp = exp((abs((m - n)) - (l + (0.5 * (m * (n + (m * 0.5))))))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[M, -0.00135], N[Not[LessEqual[M, 2.6e-42]], $MachinePrecision]], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision], N[Exp[N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - N[(l + N[(0.5 * N[(m * N[(n + N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq -0.00135 \lor \neg \left(M \leq 2.6 \cdot 10^{-42}\right):\\
\;\;\;\;\cos M \cdot e^{-{M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;e^{\left|m - n\right| - \left(\ell + 0.5 \cdot \left(m \cdot \left(n + m \cdot 0.5\right)\right)\right)}\\
\end{array}
\end{array}
if M < -0.0013500000000000001 or 2.6e-42 < M Initial program 80.5%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in M around inf 95.4%
mul-1-neg95.4%
Simplified95.4%
if -0.0013500000000000001 < M < 2.6e-42Initial program 70.8%
Taylor expanded in K around 0 94.3%
cos-neg94.3%
Simplified94.3%
Taylor expanded in n around 0 58.0%
+-commutative48.4%
unpow248.4%
distribute-rgt-out50.8%
*-commutative50.8%
*-commutative50.8%
Simplified62.7%
Taylor expanded in M around 0 62.7%
associate--r+62.7%
fabs-sub62.7%
*-commutative62.7%
Simplified62.7%
Taylor expanded in M around 0 62.7%
Final simplification79.1%
(FPCore (K m n M l)
:precision binary64
(if (<= m -1.45e-57)
(exp (- (fabs (- m n)) (+ l (* 0.5 (* m (+ n (* m 0.5)))))))
(if (<= m -1.7e-175)
(* (cos M) (pow (exp M) n))
(if (<= m 2.05e-142)
(* (exp (- l)) (cos (- (* m (* 0.5 K)) M)))
(* (cos M) (exp (* n (* m -0.5))))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -1.45e-57) {
tmp = exp((fabs((m - n)) - (l + (0.5 * (m * (n + (m * 0.5)))))));
} else if (m <= -1.7e-175) {
tmp = cos(M) * pow(exp(M), n);
} else if (m <= 2.05e-142) {
tmp = exp(-l) * cos(((m * (0.5 * K)) - M));
} 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 <= (-1.45d-57)) then
tmp = exp((abs((m - n)) - (l + (0.5d0 * (m * (n + (m * 0.5d0)))))))
else if (m <= (-1.7d-175)) then
tmp = cos(m_1) * (exp(m_1) ** n)
else if (m <= 2.05d-142) then
tmp = exp(-l) * cos(((m * (0.5d0 * k)) - m_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 tmp;
if (m <= -1.45e-57) {
tmp = Math.exp((Math.abs((m - n)) - (l + (0.5 * (m * (n + (m * 0.5)))))));
} else if (m <= -1.7e-175) {
tmp = Math.cos(M) * Math.pow(Math.exp(M), n);
} else if (m <= 2.05e-142) {
tmp = Math.exp(-l) * Math.cos(((m * (0.5 * K)) - M));
} else {
tmp = Math.cos(M) * Math.exp((n * (m * -0.5)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -1.45e-57: tmp = math.exp((math.fabs((m - n)) - (l + (0.5 * (m * (n + (m * 0.5))))))) elif m <= -1.7e-175: tmp = math.cos(M) * math.pow(math.exp(M), n) elif m <= 2.05e-142: tmp = math.exp(-l) * math.cos(((m * (0.5 * K)) - M)) 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 <= -1.45e-57) tmp = exp(Float64(abs(Float64(m - n)) - Float64(l + Float64(0.5 * Float64(m * Float64(n + Float64(m * 0.5))))))); elseif (m <= -1.7e-175) tmp = Float64(cos(M) * (exp(M) ^ n)); elseif (m <= 2.05e-142) tmp = Float64(exp(Float64(-l)) * cos(Float64(Float64(m * Float64(0.5 * K)) - M))); 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 <= -1.45e-57) tmp = exp((abs((m - n)) - (l + (0.5 * (m * (n + (m * 0.5))))))); elseif (m <= -1.7e-175) tmp = cos(M) * (exp(M) ^ n); elseif (m <= 2.05e-142) tmp = exp(-l) * cos(((m * (0.5 * K)) - M)); else tmp = cos(M) * exp((n * (m * -0.5))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -1.45e-57], N[Exp[N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - N[(l + N[(0.5 * N[(m * N[(n + N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[m, -1.7e-175], N[(N[Cos[M], $MachinePrecision] * N[Power[N[Exp[M], $MachinePrecision], n], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.05e-142], N[(N[Exp[(-l)], $MachinePrecision] * N[Cos[N[(N[(m * N[(0.5 * K), $MachinePrecision]), $MachinePrecision] - M), $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 -1.45 \cdot 10^{-57}:\\
\;\;\;\;e^{\left|m - n\right| - \left(\ell + 0.5 \cdot \left(m \cdot \left(n + m \cdot 0.5\right)\right)\right)}\\
\mathbf{elif}\;m \leq -1.7 \cdot 10^{-175}:\\
\;\;\;\;\cos M \cdot {\left(e^{M}\right)}^{n}\\
\mathbf{elif}\;m \leq 2.05 \cdot 10^{-142}:\\
\;\;\;\;e^{-\ell} \cdot \cos \left(m \cdot \left(0.5 \cdot K\right) - M\right)\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{n \cdot \left(m \cdot -0.5\right)}\\
\end{array}
\end{array}
if m < -1.45000000000000013e-57Initial program 71.4%
Taylor expanded in K around 0 98.6%
cos-neg98.6%
Simplified98.6%
Taylor expanded in n around 0 71.7%
+-commutative54.5%
unpow254.5%
distribute-rgt-out58.8%
*-commutative58.8%
*-commutative58.8%
Simplified80.3%
Taylor expanded in M around 0 74.7%
associate--r+74.7%
fabs-sub74.7%
*-commutative74.7%
Simplified74.7%
Taylor expanded in M around 0 74.7%
if -1.45000000000000013e-57 < m < -1.7e-175Initial program 83.4%
Taylor expanded in n around 0 54.6%
+-commutative54.6%
unpow254.6%
distribute-rgt-out58.8%
*-commutative58.8%
*-commutative58.8%
Simplified58.8%
Taylor expanded in n around inf 38.7%
Taylor expanded in m around 0 30.7%
Taylor expanded in K around 0 43.8%
cos-neg43.8%
exp-prod51.9%
Simplified51.9%
if -1.7e-175 < m < 2.05e-142Initial program 82.0%
Taylor expanded in l around inf 48.8%
mul-1-neg48.8%
Simplified48.8%
Taylor expanded in n around 0 53.9%
*-commutative53.9%
associate-*r*53.9%
*-commutative53.9%
Simplified53.9%
if 2.05e-142 < m Initial program 71.2%
Taylor expanded in K around 0 99.1%
cos-neg99.1%
Simplified99.1%
Taylor expanded in n around 0 74.8%
+-commutative57.3%
unpow257.3%
distribute-rgt-out62.1%
*-commutative62.1%
*-commutative62.1%
Simplified83.1%
Taylor expanded in M around 0 75.1%
associate--r+75.1%
fabs-sub75.1%
*-commutative75.1%
Simplified75.1%
Taylor expanded in n around inf 37.7%
associate-*r*37.7%
*-commutative37.7%
Simplified37.7%
Final simplification53.9%
(FPCore (K m n M l) :precision binary64 (if (<= n 56.0) (exp (- (fabs (- m n)) (+ l (* 0.5 (* m (+ n (* m 0.5))))))) (* (cos M) (exp (* (pow n 2.0) -0.25)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 56.0) {
tmp = exp((fabs((m - n)) - (l + (0.5 * (m * (n + (m * 0.5)))))));
} else {
tmp = cos(M) * exp((pow(n, 2.0) * -0.25));
}
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 <= 56.0d0) then
tmp = exp((abs((m - n)) - (l + (0.5d0 * (m * (n + (m * 0.5d0)))))))
else
tmp = cos(m_1) * exp(((n ** 2.0d0) * (-0.25d0)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 56.0) {
tmp = Math.exp((Math.abs((m - n)) - (l + (0.5 * (m * (n + (m * 0.5)))))));
} else {
tmp = Math.cos(M) * Math.exp((Math.pow(n, 2.0) * -0.25));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 56.0: tmp = math.exp((math.fabs((m - n)) - (l + (0.5 * (m * (n + (m * 0.5))))))) else: tmp = math.cos(M) * math.exp((math.pow(n, 2.0) * -0.25)) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 56.0) tmp = exp(Float64(abs(Float64(m - n)) - Float64(l + Float64(0.5 * Float64(m * Float64(n + Float64(m * 0.5))))))); else tmp = Float64(cos(M) * exp(Float64((n ^ 2.0) * -0.25))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 56.0) tmp = exp((abs((m - n)) - (l + (0.5 * (m * (n + (m * 0.5))))))); else tmp = cos(M) * exp(((n ^ 2.0) * -0.25)); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 56.0], N[Exp[N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - N[(l + N[(0.5 * N[(m * N[(n + N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[Power[n, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 56:\\
\;\;\;\;e^{\left|m - n\right| - \left(\ell + 0.5 \cdot \left(m \cdot \left(n + m \cdot 0.5\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{{n}^{2} \cdot -0.25}\\
\end{array}
\end{array}
if n < 56Initial program 77.7%
Taylor expanded in K around 0 96.1%
cos-neg96.1%
Simplified96.1%
Taylor expanded in n around 0 76.8%
+-commutative64.1%
unpow264.1%
distribute-rgt-out68.4%
*-commutative68.4%
*-commutative68.4%
Simplified83.2%
Taylor expanded in M around 0 67.8%
associate--r+67.8%
fabs-sub67.8%
*-commutative67.8%
Simplified67.8%
Taylor expanded in M around 0 67.2%
if 56 < n Initial program 69.7%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification75.7%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (cos (- M)) (exp (* M n)))))
(if (<= l -5.7e+16)
(* (cos (* (* m 0.5) K)) (exp l))
(if (<= l -1e-238)
t_0
(if (<= l 4.4e-144)
(* (cos M) (exp (* n (* m -0.5))))
(if (<= l 1.35e-11) t_0 (* (cos M) (exp (- l)))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(-M) * exp((M * n));
double tmp;
if (l <= -5.7e+16) {
tmp = cos(((m * 0.5) * K)) * exp(l);
} else if (l <= -1e-238) {
tmp = t_0;
} else if (l <= 4.4e-144) {
tmp = cos(M) * exp((n * (m * -0.5)));
} else if (l <= 1.35e-11) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = cos(-m_1) * exp((m_1 * n))
if (l <= (-5.7d+16)) then
tmp = cos(((m * 0.5d0) * k)) * exp(l)
else if (l <= (-1d-238)) then
tmp = t_0
else if (l <= 4.4d-144) then
tmp = cos(m_1) * exp((n * (m * (-0.5d0))))
else if (l <= 1.35d-11) then
tmp = t_0
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 t_0 = Math.cos(-M) * Math.exp((M * n));
double tmp;
if (l <= -5.7e+16) {
tmp = Math.cos(((m * 0.5) * K)) * Math.exp(l);
} else if (l <= -1e-238) {
tmp = t_0;
} else if (l <= 4.4e-144) {
tmp = Math.cos(M) * Math.exp((n * (m * -0.5)));
} else if (l <= 1.35e-11) {
tmp = t_0;
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(-M) * math.exp((M * n)) tmp = 0 if l <= -5.7e+16: tmp = math.cos(((m * 0.5) * K)) * math.exp(l) elif l <= -1e-238: tmp = t_0 elif l <= 4.4e-144: tmp = math.cos(M) * math.exp((n * (m * -0.5))) elif l <= 1.35e-11: tmp = t_0 else: tmp = math.cos(M) * math.exp(-l) return tmp
function code(K, m, n, M, l) t_0 = Float64(cos(Float64(-M)) * exp(Float64(M * n))) tmp = 0.0 if (l <= -5.7e+16) tmp = Float64(cos(Float64(Float64(m * 0.5) * K)) * exp(l)); elseif (l <= -1e-238) tmp = t_0; elseif (l <= 4.4e-144) tmp = Float64(cos(M) * exp(Float64(n * Float64(m * -0.5)))); elseif (l <= 1.35e-11) tmp = t_0; else tmp = Float64(cos(M) * exp(Float64(-l))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(-M) * exp((M * n)); tmp = 0.0; if (l <= -5.7e+16) tmp = cos(((m * 0.5) * K)) * exp(l); elseif (l <= -1e-238) tmp = t_0; elseif (l <= 4.4e-144) tmp = cos(M) * exp((n * (m * -0.5))); elseif (l <= 1.35e-11) tmp = t_0; else tmp = cos(M) * exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Cos[(-M)], $MachinePrecision] * N[Exp[N[(M * n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5.7e+16], N[(N[Cos[N[(N[(m * 0.5), $MachinePrecision] * K), $MachinePrecision]], $MachinePrecision] * N[Exp[l], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-238], t$95$0, If[LessEqual[l, 4.4e-144], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(n * N[(m * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.35e-11], t$95$0, N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(-M\right) \cdot e^{M \cdot n}\\
\mathbf{if}\;\ell \leq -5.7 \cdot 10^{+16}:\\
\;\;\;\;\cos \left(\left(m \cdot 0.5\right) \cdot K\right) \cdot e^{\ell}\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-238}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 4.4 \cdot 10^{-144}:\\
\;\;\;\;\cos M \cdot e^{n \cdot \left(m \cdot -0.5\right)}\\
\mathbf{elif}\;\ell \leq 1.35 \cdot 10^{-11}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if l < -5.7e16Initial program 67.3%
Taylor expanded in l around inf 19.1%
mul-1-neg19.1%
Simplified19.1%
Taylor expanded in m around inf 19.3%
associate-*r*19.3%
*-commutative19.3%
Simplified19.3%
pow119.3%
associate-*l*19.3%
add-sqr-sqrt19.3%
sqrt-unprod19.3%
sqr-neg19.3%
sqrt-unprod0.0%
add-sqr-sqrt61.6%
Applied egg-rr61.6%
unpow161.6%
Simplified61.6%
if -5.7e16 < l < -9.9999999999999999e-239 or 4.40000000000000012e-144 < l < 1.35000000000000002e-11Initial program 77.9%
Taylor expanded in n around 0 63.1%
+-commutative63.1%
unpow263.1%
distribute-rgt-out65.6%
*-commutative65.6%
*-commutative65.6%
Simplified65.6%
Taylor expanded in n around inf 29.8%
Taylor expanded in m around 0 30.0%
Taylor expanded in K around 0 38.9%
if -9.9999999999999999e-239 < l < 4.40000000000000012e-144Initial program 81.0%
Taylor expanded in K around 0 96.2%
cos-neg96.2%
Simplified96.2%
Taylor expanded in n around 0 66.1%
+-commutative59.6%
unpow259.6%
distribute-rgt-out59.6%
*-commutative59.6%
*-commutative59.6%
Simplified72.6%
Taylor expanded in M around 0 62.0%
associate--r+62.0%
fabs-sub62.0%
*-commutative62.0%
Simplified62.0%
Taylor expanded in n around inf 43.9%
associate-*r*43.9%
*-commutative43.9%
Simplified43.9%
if 1.35000000000000002e-11 < l Initial program 75.3%
Taylor expanded in l around inf 71.7%
mul-1-neg71.7%
Simplified71.7%
Taylor expanded in K around 0 95.2%
cos-neg95.2%
Simplified95.2%
Final simplification62.0%
(FPCore (K m n M l)
:precision binary64
(if (<= m -2.95e-40)
(exp (- (fabs (- m n)) (+ l (* 0.5 (* m (+ n (* m 0.5)))))))
(if (<= m -2.2e-175)
(* (cos (- M)) (exp (* M n)))
(if (<= m 5.8e-141)
(* (exp (- l)) (cos (- (* m (* 0.5 K)) M)))
(* (cos M) (exp (* n (* m -0.5))))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -2.95e-40) {
tmp = exp((fabs((m - n)) - (l + (0.5 * (m * (n + (m * 0.5)))))));
} else if (m <= -2.2e-175) {
tmp = cos(-M) * exp((M * n));
} else if (m <= 5.8e-141) {
tmp = exp(-l) * cos(((m * (0.5 * K)) - M));
} 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 <= (-2.95d-40)) then
tmp = exp((abs((m - n)) - (l + (0.5d0 * (m * (n + (m * 0.5d0)))))))
else if (m <= (-2.2d-175)) then
tmp = cos(-m_1) * exp((m_1 * n))
else if (m <= 5.8d-141) then
tmp = exp(-l) * cos(((m * (0.5d0 * k)) - m_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 tmp;
if (m <= -2.95e-40) {
tmp = Math.exp((Math.abs((m - n)) - (l + (0.5 * (m * (n + (m * 0.5)))))));
} else if (m <= -2.2e-175) {
tmp = Math.cos(-M) * Math.exp((M * n));
} else if (m <= 5.8e-141) {
tmp = Math.exp(-l) * Math.cos(((m * (0.5 * K)) - M));
} else {
tmp = Math.cos(M) * Math.exp((n * (m * -0.5)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -2.95e-40: tmp = math.exp((math.fabs((m - n)) - (l + (0.5 * (m * (n + (m * 0.5))))))) elif m <= -2.2e-175: tmp = math.cos(-M) * math.exp((M * n)) elif m <= 5.8e-141: tmp = math.exp(-l) * math.cos(((m * (0.5 * K)) - M)) 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 <= -2.95e-40) tmp = exp(Float64(abs(Float64(m - n)) - Float64(l + Float64(0.5 * Float64(m * Float64(n + Float64(m * 0.5))))))); elseif (m <= -2.2e-175) tmp = Float64(cos(Float64(-M)) * exp(Float64(M * n))); elseif (m <= 5.8e-141) tmp = Float64(exp(Float64(-l)) * cos(Float64(Float64(m * Float64(0.5 * K)) - M))); 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 <= -2.95e-40) tmp = exp((abs((m - n)) - (l + (0.5 * (m * (n + (m * 0.5))))))); elseif (m <= -2.2e-175) tmp = cos(-M) * exp((M * n)); elseif (m <= 5.8e-141) tmp = exp(-l) * cos(((m * (0.5 * K)) - M)); else tmp = cos(M) * exp((n * (m * -0.5))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -2.95e-40], N[Exp[N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - N[(l + N[(0.5 * N[(m * N[(n + N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[m, -2.2e-175], N[(N[Cos[(-M)], $MachinePrecision] * N[Exp[N[(M * n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 5.8e-141], N[(N[Exp[(-l)], $MachinePrecision] * N[Cos[N[(N[(m * N[(0.5 * K), $MachinePrecision]), $MachinePrecision] - M), $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 -2.95 \cdot 10^{-40}:\\
\;\;\;\;e^{\left|m - n\right| - \left(\ell + 0.5 \cdot \left(m \cdot \left(n + m \cdot 0.5\right)\right)\right)}\\
\mathbf{elif}\;m \leq -2.2 \cdot 10^{-175}:\\
\;\;\;\;\cos \left(-M\right) \cdot e^{M \cdot n}\\
\mathbf{elif}\;m \leq 5.8 \cdot 10^{-141}:\\
\;\;\;\;e^{-\ell} \cdot \cos \left(m \cdot \left(0.5 \cdot K\right) - M\right)\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{n \cdot \left(m \cdot -0.5\right)}\\
\end{array}
\end{array}
if m < -2.94999999999999983e-40Initial program 72.1%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around 0 73.8%
+-commutative56.0%
unpow256.0%
distribute-rgt-out60.5%
*-commutative60.5%
*-commutative60.5%
Simplified82.6%
Taylor expanded in M around 0 76.8%
associate--r+76.8%
fabs-sub76.8%
*-commutative76.8%
Simplified76.8%
Taylor expanded in M around 0 76.8%
if -2.94999999999999983e-40 < m < -2.2e-175Initial program 80.8%
Taylor expanded in n around 0 50.5%
+-commutative50.5%
unpow250.5%
distribute-rgt-out54.3%
*-commutative54.3%
*-commutative54.3%
Simplified54.3%
Taylor expanded in n around inf 39.7%
Taylor expanded in m around 0 32.2%
Taylor expanded in K around 0 44.3%
if -2.2e-175 < m < 5.7999999999999999e-141Initial program 82.0%
Taylor expanded in l around inf 48.8%
mul-1-neg48.8%
Simplified48.8%
Taylor expanded in n around 0 53.9%
*-commutative53.9%
associate-*r*53.9%
*-commutative53.9%
Simplified53.9%
if 5.7999999999999999e-141 < m Initial program 71.2%
Taylor expanded in K around 0 99.1%
cos-neg99.1%
Simplified99.1%
Taylor expanded in n around 0 74.8%
+-commutative57.3%
unpow257.3%
distribute-rgt-out62.1%
*-commutative62.1%
*-commutative62.1%
Simplified83.1%
Taylor expanded in M around 0 75.1%
associate--r+75.1%
fabs-sub75.1%
*-commutative75.1%
Simplified75.1%
Taylor expanded in n around inf 37.7%
associate-*r*37.7%
*-commutative37.7%
Simplified37.7%
Final simplification53.6%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (cos (- M)) (exp (* M n)))))
(if (<= l -5.6e-238)
t_0
(if (<= l 3.1e-150)
(* (cos M) (exp (* n (* m -0.5))))
(if (<= l 1.35e-11) t_0 (* (cos M) (exp (- l))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(-M) * exp((M * n));
double tmp;
if (l <= -5.6e-238) {
tmp = t_0;
} else if (l <= 3.1e-150) {
tmp = cos(M) * exp((n * (m * -0.5)));
} else if (l <= 1.35e-11) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = cos(-m_1) * exp((m_1 * n))
if (l <= (-5.6d-238)) then
tmp = t_0
else if (l <= 3.1d-150) then
tmp = cos(m_1) * exp((n * (m * (-0.5d0))))
else if (l <= 1.35d-11) then
tmp = t_0
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 t_0 = Math.cos(-M) * Math.exp((M * n));
double tmp;
if (l <= -5.6e-238) {
tmp = t_0;
} else if (l <= 3.1e-150) {
tmp = Math.cos(M) * Math.exp((n * (m * -0.5)));
} else if (l <= 1.35e-11) {
tmp = t_0;
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(-M) * math.exp((M * n)) tmp = 0 if l <= -5.6e-238: tmp = t_0 elif l <= 3.1e-150: tmp = math.cos(M) * math.exp((n * (m * -0.5))) elif l <= 1.35e-11: tmp = t_0 else: tmp = math.cos(M) * math.exp(-l) return tmp
function code(K, m, n, M, l) t_0 = Float64(cos(Float64(-M)) * exp(Float64(M * n))) tmp = 0.0 if (l <= -5.6e-238) tmp = t_0; elseif (l <= 3.1e-150) tmp = Float64(cos(M) * exp(Float64(n * Float64(m * -0.5)))); elseif (l <= 1.35e-11) tmp = t_0; else tmp = Float64(cos(M) * exp(Float64(-l))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(-M) * exp((M * n)); tmp = 0.0; if (l <= -5.6e-238) tmp = t_0; elseif (l <= 3.1e-150) tmp = cos(M) * exp((n * (m * -0.5))); elseif (l <= 1.35e-11) tmp = t_0; else tmp = cos(M) * exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Cos[(-M)], $MachinePrecision] * N[Exp[N[(M * n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5.6e-238], t$95$0, If[LessEqual[l, 3.1e-150], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(n * N[(m * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.35e-11], t$95$0, N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(-M\right) \cdot e^{M \cdot n}\\
\mathbf{if}\;\ell \leq -5.6 \cdot 10^{-238}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 3.1 \cdot 10^{-150}:\\
\;\;\;\;\cos M \cdot e^{n \cdot \left(m \cdot -0.5\right)}\\
\mathbf{elif}\;\ell \leq 1.35 \cdot 10^{-11}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if l < -5.60000000000000008e-238 or 3.09999999999999998e-150 < l < 1.35000000000000002e-11Initial program 74.1%
Taylor expanded in n around 0 55.8%
+-commutative55.8%
unpow255.8%
distribute-rgt-out60.5%
*-commutative60.5%
*-commutative60.5%
Simplified60.5%
Taylor expanded in n around inf 29.5%
Taylor expanded in m around 0 28.2%
Taylor expanded in K around 0 37.7%
if -5.60000000000000008e-238 < l < 3.09999999999999998e-150Initial program 80.6%
Taylor expanded in K around 0 96.1%
cos-neg96.1%
Simplified96.1%
Taylor expanded in n around 0 67.5%
+-commutative60.9%
unpow260.9%
distribute-rgt-out60.9%
*-commutative60.9%
*-commutative60.9%
Simplified74.2%
Taylor expanded in M around 0 63.4%
associate--r+63.4%
fabs-sub63.4%
*-commutative63.4%
Simplified63.4%
Taylor expanded in n around inf 44.8%
associate-*r*44.8%
*-commutative44.8%
Simplified44.8%
if 1.35000000000000002e-11 < l Initial program 75.3%
Taylor expanded in l around inf 71.7%
mul-1-neg71.7%
Simplified71.7%
Taylor expanded in K around 0 95.2%
cos-neg95.2%
Simplified95.2%
Final simplification57.1%
(FPCore (K m n M l)
:precision binary64
(if (<= l -1.56e+34)
(* (cos (* (* m 0.5) K)) (exp l))
(if (<= l 6.9e-15)
(* (cos M) (exp (* n (- M (* m 0.5)))))
(* (cos M) (exp (- l))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= -1.56e+34) {
tmp = cos(((m * 0.5) * K)) * exp(l);
} else if (l <= 6.9e-15) {
tmp = cos(M) * exp((n * (M - (m * 0.5))));
} else {
tmp = cos(M) * exp(-l);
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (l <= (-1.56d+34)) then
tmp = cos(((m * 0.5d0) * k)) * exp(l)
else if (l <= 6.9d-15) then
tmp = cos(m_1) * exp((n * (m_1 - (m * 0.5d0))))
else
tmp = cos(m_1) * exp(-l)
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= -1.56e+34) {
tmp = Math.cos(((m * 0.5) * K)) * Math.exp(l);
} else if (l <= 6.9e-15) {
tmp = Math.cos(M) * Math.exp((n * (M - (m * 0.5))));
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= -1.56e+34: tmp = math.cos(((m * 0.5) * K)) * math.exp(l) elif l <= 6.9e-15: tmp = math.cos(M) * math.exp((n * (M - (m * 0.5)))) else: tmp = math.cos(M) * math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= -1.56e+34) tmp = Float64(cos(Float64(Float64(m * 0.5) * K)) * exp(l)); elseif (l <= 6.9e-15) tmp = Float64(cos(M) * exp(Float64(n * Float64(M - Float64(m * 0.5))))); 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 (l <= -1.56e+34) tmp = cos(((m * 0.5) * K)) * exp(l); elseif (l <= 6.9e-15) tmp = cos(M) * exp((n * (M - (m * 0.5)))); else tmp = cos(M) * exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, -1.56e+34], N[(N[Cos[N[(N[(m * 0.5), $MachinePrecision] * K), $MachinePrecision]], $MachinePrecision] * N[Exp[l], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.9e-15], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(n * N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.56 \cdot 10^{+34}:\\
\;\;\;\;\cos \left(\left(m \cdot 0.5\right) \cdot K\right) \cdot e^{\ell}\\
\mathbf{elif}\;\ell \leq 6.9 \cdot 10^{-15}:\\
\;\;\;\;\cos M \cdot e^{n \cdot \left(M - m \cdot 0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if l < -1.5600000000000001e34Initial program 69.8%
Taylor expanded in l around inf 21.7%
mul-1-neg21.7%
Simplified21.7%
Taylor expanded in m around inf 21.9%
associate-*r*21.9%
*-commutative21.9%
Simplified21.9%
pow121.9%
associate-*l*21.9%
add-sqr-sqrt21.9%
sqrt-unprod21.9%
sqr-neg21.9%
sqrt-unprod0.0%
add-sqr-sqrt60.9%
Applied egg-rr60.9%
unpow160.9%
Simplified60.9%
if -1.5600000000000001e34 < l < 6.9000000000000001e-15Initial program 77.6%
Taylor expanded in K around 0 95.9%
cos-neg95.9%
Simplified95.9%
Taylor expanded in n around 0 68.8%
+-commutative61.0%
unpow261.0%
distribute-rgt-out61.8%
*-commutative61.8%
*-commutative61.8%
Simplified74.1%
Taylor expanded in n around inf 39.2%
if 6.9000000000000001e-15 < l Initial program 75.6%
Taylor expanded in l around inf 70.9%
mul-1-neg70.9%
Simplified70.9%
Taylor expanded in K around 0 94.1%
cos-neg94.1%
Simplified94.1%
Final simplification60.4%
(FPCore (K m n M l) :precision binary64 (if (<= l 1.35e-11) (* (cos (- M)) (exp (* M n))) (* (cos M) (exp (- l)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= 1.35e-11) {
tmp = cos(-M) * exp((M * n));
} else {
tmp = cos(M) * exp(-l);
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (l <= 1.35d-11) then
tmp = cos(-m_1) * exp((m_1 * n))
else
tmp = cos(m_1) * exp(-l)
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= 1.35e-11) {
tmp = Math.cos(-M) * Math.exp((M * n));
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= 1.35e-11: tmp = math.cos(-M) * math.exp((M * n)) else: tmp = math.cos(M) * math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= 1.35e-11) tmp = Float64(cos(Float64(-M)) * exp(Float64(M * n))); 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 (l <= 1.35e-11) tmp = cos(-M) * exp((M * n)); else tmp = cos(M) * exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, 1.35e-11], N[(N[Cos[(-M)], $MachinePrecision] * N[Exp[N[(M * n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.35 \cdot 10^{-11}:\\
\;\;\;\;\cos \left(-M\right) \cdot e^{M \cdot n}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if l < 1.35000000000000002e-11Initial program 75.8%
Taylor expanded in n around 0 57.1%
+-commutative57.1%
unpow257.1%
distribute-rgt-out60.6%
*-commutative60.6%
*-commutative60.6%
Simplified60.6%
Taylor expanded in n around inf 32.2%
Taylor expanded in m around 0 27.0%
Taylor expanded in K around 0 35.1%
if 1.35000000000000002e-11 < l Initial program 75.3%
Taylor expanded in l around inf 71.7%
mul-1-neg71.7%
Simplified71.7%
Taylor expanded in K around 0 95.2%
cos-neg95.2%
Simplified95.2%
Final simplification54.1%
(FPCore (K m n M l) :precision binary64 (* (cos M) (exp (- l))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * 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 = cos(m_1) * exp(-l)
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.exp(-l);
}
def code(K, m, n, M, l): return math.cos(M) * math.exp(-l)
function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(-l))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * exp(-l); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{-\ell}
\end{array}
Initial program 75.6%
Taylor expanded in l around inf 31.3%
mul-1-neg31.3%
Simplified31.3%
Taylor expanded in K around 0 40.3%
cos-neg40.3%
Simplified40.3%
Final simplification40.3%
(FPCore (K m n M l) :precision binary64 (exp (- l)))
double code(double K, double m, double n, double M, double l) {
return exp(-l);
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = exp(-l)
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.exp(-l);
}
def code(K, m, n, M, l): return math.exp(-l)
function code(K, m, n, M, l) return exp(Float64(-l)) end
function tmp = code(K, m, n, M, l) tmp = exp(-l); end
code[K_, m_, n_, M_, l_] := N[Exp[(-l)], $MachinePrecision]
\begin{array}{l}
\\
e^{-\ell}
\end{array}
Initial program 75.6%
Taylor expanded in l around inf 31.3%
mul-1-neg31.3%
Simplified31.3%
Taylor expanded in m around inf 34.2%
associate-*r*34.2%
*-commutative34.2%
Simplified34.2%
Taylor expanded in K around 0 39.9%
Final simplification39.9%
(FPCore (K m n M l) :precision binary64 (cos M))
double code(double K, double m, double n, double M, double l) {
return cos(M);
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos(m_1)
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M);
}
def code(K, m, n, M, l): return math.cos(M)
function code(K, m, n, M, l) return cos(M) end
function tmp = code(K, m, n, M, l) tmp = cos(M); end
code[K_, m_, n_, M_, l_] := N[Cos[M], $MachinePrecision]
\begin{array}{l}
\\
\cos M
\end{array}
Initial program 75.6%
Taylor expanded in m around inf 38.9%
*-commutative38.9%
Simplified38.9%
Taylor expanded in m around 0 6.3%
*-commutative6.3%
associate-*r*6.3%
Simplified6.3%
Taylor expanded in K around 0 6.7%
cos-neg6.7%
Simplified6.7%
Final simplification6.7%
herbie shell --seed 2024130
(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)))))))