
(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(abs(Float64(m - n)) - Float64(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[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - N[(l + N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{\left|m - n\right| - \left(\ell + {\left(\frac{m + n}{2} - M\right)}^{2}\right)}
\end{array}
Initial program 76.9%
associate-/l*76.9%
exp-diff26.2%
sub-neg26.2%
exp-sum18.7%
associate-/r*18.7%
exp-diff23.0%
exp-diff76.9%
sub-neg76.9%
remove-double-neg76.9%
fabs-sub76.9%
Simplified76.9%
Taylor expanded in K around 0 97.5%
cos-neg97.5%
Simplified97.5%
Final simplification97.5%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (- M (* m 0.5))))
(if (<= n 3.05e+35)
(*
(cos (- (/ K (/ 2.0 n)) M))
(exp (+ (fabs (- m n)) (- (* (- n t_0) t_0) l))))
(* (cos M) (exp (* -0.25 (pow n 2.0)))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = M - (m * 0.5);
double tmp;
if (n <= 3.05e+35) {
tmp = cos(((K / (2.0 / n)) - M)) * exp((fabs((m - n)) + (((n - t_0) * t_0) - l)));
} else {
tmp = cos(M) * exp((-0.25 * pow(n, 2.0)));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: tmp
t_0 = m_1 - (m * 0.5d0)
if (n <= 3.05d+35) then
tmp = cos(((k / (2.0d0 / n)) - m_1)) * exp((abs((m - n)) + (((n - t_0) * t_0) - l)))
else
tmp = cos(m_1) * exp(((-0.25d0) * (n ** 2.0d0)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = M - (m * 0.5);
double tmp;
if (n <= 3.05e+35) {
tmp = Math.cos(((K / (2.0 / n)) - M)) * Math.exp((Math.abs((m - n)) + (((n - t_0) * t_0) - l)));
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(n, 2.0)));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = M - (m * 0.5) tmp = 0 if n <= 3.05e+35: tmp = math.cos(((K / (2.0 / n)) - M)) * math.exp((math.fabs((m - n)) + (((n - t_0) * t_0) - l))) else: tmp = math.cos(M) * math.exp((-0.25 * math.pow(n, 2.0))) return tmp
function code(K, m, n, M, l) t_0 = Float64(M - Float64(m * 0.5)) tmp = 0.0 if (n <= 3.05e+35) tmp = Float64(cos(Float64(Float64(K / Float64(2.0 / n)) - M)) * exp(Float64(abs(Float64(m - n)) + Float64(Float64(Float64(n - t_0) * t_0) - l)))); else tmp = Float64(cos(M) * exp(Float64(-0.25 * (n ^ 2.0)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = M - (m * 0.5); tmp = 0.0; if (n <= 3.05e+35) tmp = cos(((K / (2.0 / n)) - M)) * exp((abs((m - n)) + (((n - t_0) * t_0) - l))); else tmp = cos(M) * exp((-0.25 * (n ^ 2.0))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, 3.05e+35], N[(N[Cos[N[(N[(K / N[(2.0 / n), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] + N[(N[(N[(n - t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := M - m \cdot 0.5\\
\mathbf{if}\;n \leq 3.05 \cdot 10^{+35}:\\
\;\;\;\;\cos \left(\frac{K}{\frac{2}{n}} - M\right) \cdot e^{\left|m - n\right| + \left(\left(n - t_0\right) \cdot t_0 - \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if n < 3.04999999999999989e35Initial program 79.4%
associate-/l*79.5%
exp-diff30.5%
sub-neg30.5%
exp-sum22.8%
associate-/r*22.8%
exp-diff28.1%
exp-diff79.5%
sub-neg79.5%
remove-double-neg79.5%
fabs-sub79.5%
Simplified79.5%
Taylor expanded in n around 0 65.9%
+-commutative65.9%
unpow265.9%
distribute-rgt-out68.7%
*-commutative68.7%
*-commutative68.7%
Simplified68.7%
Taylor expanded in m around 0 79.4%
if 3.04999999999999989e35 < n Initial program 65.2%
associate-/l*65.2%
exp-diff6.5%
sub-neg6.5%
exp-sum0.0%
associate-/r*0.0%
exp-diff0.0%
exp-diff65.2%
sub-neg65.2%
remove-double-neg65.2%
fabs-sub65.2%
Simplified65.2%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around inf 100.0%
Final simplification83.1%
(FPCore (K m n M l)
:precision binary64
(if (<= m -5.5e+65)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(*
(cos M)
(exp (- (* (- (* n 0.5) M) (- (- M (* n 0.5)) m)) (+ l (- m n)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -5.5e+65) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else {
tmp = cos(M) * exp(((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) - (l + (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 <= (-5.5d+65)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else
tmp = cos(m_1) * exp(((((n * 0.5d0) - m_1) * ((m_1 - (n * 0.5d0)) - m)) - (l + (m - 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 <= -5.5e+65) {
tmp = Math.cos(M) * 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)) - (l + (m - n))));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -5.5e+65: tmp = math.cos(M) * 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)) - (l + (m - n)))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -5.5e+65) tmp = Float64(cos(M) * 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(l + Float64(m - n))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -5.5e+65) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); else tmp = cos(M) * exp(((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) - (l + (m - n)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -5.5e+65], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $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[(l + N[(m - n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -5.5 \cdot 10^{+65}:\\
\;\;\;\;\cos M \cdot 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(\ell + \left(m - n\right)\right)}\\
\end{array}
\end{array}
if m < -5.4999999999999996e65Initial program 57.1%
associate-/l*57.1%
exp-diff6.1%
sub-neg6.1%
exp-sum0.0%
associate-/r*0.0%
exp-diff2.0%
exp-diff57.1%
sub-neg57.1%
remove-double-neg57.1%
fabs-sub57.1%
Simplified57.1%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in m around inf 98.0%
if -5.4999999999999996e65 < m Initial program 81.5%
associate-/l*81.6%
exp-diff30.9%
sub-neg30.9%
exp-sum23.2%
associate-/r*23.2%
exp-diff28.0%
exp-diff81.6%
sub-neg81.6%
remove-double-neg81.6%
fabs-sub81.6%
Simplified81.6%
Taylor expanded in K around 0 97.0%
cos-neg97.0%
Simplified97.0%
Taylor expanded in m around 0 81.2%
+-commutative81.2%
unpow281.2%
distribute-rgt-out84.6%
*-commutative84.6%
*-commutative84.6%
Simplified84.6%
associate-+l-84.6%
neg-sub084.6%
associate--l-84.6%
+-commutative84.6%
add-sqr-sqrt35.3%
fabs-sqr35.3%
add-sqr-sqrt89.3%
Applied egg-rr89.3%
Final simplification91.0%
(FPCore (K m n M l)
:precision binary64
(if (<= n -2.7e-282)
(pow (exp m) (* n -0.5))
(*
(cos M)
(exp (- (* (- (* n 0.5) M) (- (- M (* n 0.5)) m)) (+ l (- m n)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= -2.7e-282) {
tmp = pow(exp(m), (n * -0.5));
} else {
tmp = cos(M) * exp(((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) - (l + (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 (n <= (-2.7d-282)) then
tmp = exp(m) ** (n * (-0.5d0))
else
tmp = cos(m_1) * exp(((((n * 0.5d0) - m_1) * ((m_1 - (n * 0.5d0)) - m)) - (l + (m - 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 <= -2.7e-282) {
tmp = Math.pow(Math.exp(m), (n * -0.5));
} else {
tmp = Math.cos(M) * Math.exp(((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) - (l + (m - n))));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= -2.7e-282: tmp = math.pow(math.exp(m), (n * -0.5)) else: tmp = math.cos(M) * math.exp(((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) - (l + (m - n)))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= -2.7e-282) tmp = exp(m) ^ Float64(n * -0.5); else tmp = Float64(cos(M) * exp(Float64(Float64(Float64(Float64(n * 0.5) - M) * Float64(Float64(M - Float64(n * 0.5)) - m)) - Float64(l + Float64(m - n))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= -2.7e-282) tmp = exp(m) ^ (n * -0.5); else tmp = cos(M) * exp(((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) - (l + (m - n)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, -2.7e-282], N[Power[N[Exp[m], $MachinePrecision], N[(n * -0.5), $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[(l + N[(m - n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.7 \cdot 10^{-282}:\\
\;\;\;\;{\left(e^{m}\right)}^{\left(n \cdot -0.5\right)}\\
\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(\ell + \left(m - n\right)\right)}\\
\end{array}
\end{array}
if n < -2.69999999999999982e-282Initial program 77.3%
associate-/l*77.4%
exp-diff25.0%
sub-neg25.0%
exp-sum15.9%
associate-/r*15.9%
exp-diff18.7%
exp-diff77.4%
sub-neg77.4%
remove-double-neg77.4%
fabs-sub77.4%
Simplified77.4%
Taylor expanded in K around 0 97.6%
cos-neg97.6%
Simplified97.6%
Taylor expanded in m around 0 73.4%
+-commutative73.4%
unpow273.4%
distribute-rgt-out78.4%
*-commutative78.4%
*-commutative78.4%
Simplified78.4%
Taylor expanded in m around inf 38.9%
Taylor expanded in M around 0 32.8%
*-commutative32.8%
associate-*r*32.8%
exp-prod28.1%
*-commutative28.1%
Simplified28.1%
if -2.69999999999999982e-282 < n Initial program 76.3%
associate-/l*76.3%
exp-diff27.7%
sub-neg27.7%
exp-sum22.4%
associate-/r*22.4%
exp-diff28.6%
exp-diff76.3%
sub-neg76.3%
remove-double-neg76.3%
fabs-sub76.3%
Simplified76.3%
Taylor expanded in K around 0 97.4%
cos-neg97.4%
Simplified97.4%
Taylor expanded in m around 0 76.4%
+-commutative76.4%
unpow276.4%
distribute-rgt-out82.6%
*-commutative82.6%
*-commutative82.6%
Simplified82.6%
associate-+l-82.6%
neg-sub082.6%
associate--l-82.6%
+-commutative82.6%
add-sqr-sqrt70.1%
fabs-sqr70.1%
add-sqr-sqrt86.1%
Applied egg-rr86.1%
Final simplification53.7%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (cos M) (exp (- l)))) (t_1 (* (cos M) (exp (* M m)))))
(if (<= l -2.4e+267)
t_0
(if (<= l -1.25e+42)
(pow (exp m) (* n -0.5))
(if (<= l -1.3e-305)
t_1
(if (<= l 1.1e-42)
(exp (* -0.5 (* m n)))
(if (<= l 1.5e-12) t_1 t_0)))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(M) * exp(-l);
double t_1 = cos(M) * exp((M * m));
double tmp;
if (l <= -2.4e+267) {
tmp = t_0;
} else if (l <= -1.25e+42) {
tmp = pow(exp(m), (n * -0.5));
} else if (l <= -1.3e-305) {
tmp = t_1;
} else if (l <= 1.1e-42) {
tmp = exp((-0.5 * (m * n)));
} else if (l <= 1.5e-12) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_0 = cos(m_1) * exp(-l)
t_1 = cos(m_1) * exp((m_1 * m))
if (l <= (-2.4d+267)) then
tmp = t_0
else if (l <= (-1.25d+42)) then
tmp = exp(m) ** (n * (-0.5d0))
else if (l <= (-1.3d-305)) then
tmp = t_1
else if (l <= 1.1d-42) then
tmp = exp(((-0.5d0) * (m * n)))
else if (l <= 1.5d-12) then
tmp = t_1
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.cos(M) * Math.exp(-l);
double t_1 = Math.cos(M) * Math.exp((M * m));
double tmp;
if (l <= -2.4e+267) {
tmp = t_0;
} else if (l <= -1.25e+42) {
tmp = Math.pow(Math.exp(m), (n * -0.5));
} else if (l <= -1.3e-305) {
tmp = t_1;
} else if (l <= 1.1e-42) {
tmp = Math.exp((-0.5 * (m * n)));
} else if (l <= 1.5e-12) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(M) * math.exp(-l) t_1 = math.cos(M) * math.exp((M * m)) tmp = 0 if l <= -2.4e+267: tmp = t_0 elif l <= -1.25e+42: tmp = math.pow(math.exp(m), (n * -0.5)) elif l <= -1.3e-305: tmp = t_1 elif l <= 1.1e-42: tmp = math.exp((-0.5 * (m * n))) elif l <= 1.5e-12: tmp = t_1 else: tmp = t_0 return tmp
function code(K, m, n, M, l) t_0 = Float64(cos(M) * exp(Float64(-l))) t_1 = Float64(cos(M) * exp(Float64(M * m))) tmp = 0.0 if (l <= -2.4e+267) tmp = t_0; elseif (l <= -1.25e+42) tmp = exp(m) ^ Float64(n * -0.5); elseif (l <= -1.3e-305) tmp = t_1; elseif (l <= 1.1e-42) tmp = exp(Float64(-0.5 * Float64(m * n))); elseif (l <= 1.5e-12) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(M) * exp(-l); t_1 = cos(M) * exp((M * m)); tmp = 0.0; if (l <= -2.4e+267) tmp = t_0; elseif (l <= -1.25e+42) tmp = exp(m) ^ (n * -0.5); elseif (l <= -1.3e-305) tmp = t_1; elseif (l <= 1.1e-42) tmp = exp((-0.5 * (m * n))); elseif (l <= 1.5e-12) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.4e+267], t$95$0, If[LessEqual[l, -1.25e+42], N[Power[N[Exp[m], $MachinePrecision], N[(n * -0.5), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, -1.3e-305], t$95$1, If[LessEqual[l, 1.1e-42], N[Exp[N[(-0.5 * N[(m * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 1.5e-12], t$95$1, t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos M \cdot e^{-\ell}\\
t_1 := \cos M \cdot e^{M \cdot m}\\
\mathbf{if}\;\ell \leq -2.4 \cdot 10^{+267}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -1.25 \cdot 10^{+42}:\\
\;\;\;\;{\left(e^{m}\right)}^{\left(n \cdot -0.5\right)}\\
\mathbf{elif}\;\ell \leq -1.3 \cdot 10^{-305}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 1.1 \cdot 10^{-42}:\\
\;\;\;\;e^{-0.5 \cdot \left(m \cdot n\right)}\\
\mathbf{elif}\;\ell \leq 1.5 \cdot 10^{-12}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -2.39999999999999984e267 or 1.5000000000000001e-12 < l Initial program 80.3%
associate-/l*80.3%
exp-diff55.3%
sub-neg55.3%
exp-sum30.3%
associate-/r*30.3%
exp-diff31.6%
exp-diff80.3%
sub-neg80.3%
remove-double-neg80.3%
fabs-sub80.3%
Simplified80.3%
Taylor expanded in K around 0 99.6%
cos-neg99.6%
Simplified99.6%
Taylor expanded in l around inf 91.9%
neg-mul-191.9%
Simplified91.9%
if -2.39999999999999984e267 < l < -1.25000000000000002e42Initial program 69.6%
associate-/l*69.6%
exp-diff6.5%
sub-neg6.5%
exp-sum6.5%
associate-/r*6.5%
exp-diff23.9%
exp-diff69.6%
sub-neg69.6%
remove-double-neg69.6%
fabs-sub69.6%
Simplified69.6%
Taylor expanded in K around 0 95.7%
cos-neg95.7%
Simplified95.7%
Taylor expanded in m around 0 67.7%
+-commutative67.7%
unpow267.7%
distribute-rgt-out74.3%
*-commutative74.3%
*-commutative74.3%
Simplified74.3%
Taylor expanded in m around inf 40.6%
Taylor expanded in M around 0 32.2%
*-commutative32.2%
associate-*r*32.2%
exp-prod23.7%
*-commutative23.7%
Simplified23.7%
if -1.25000000000000002e42 < l < -1.3000000000000001e-305 or 1.10000000000000003e-42 < l < 1.5000000000000001e-12Initial program 71.3%
associate-/l*71.6%
exp-diff12.3%
sub-neg12.3%
exp-sum12.3%
associate-/r*12.3%
exp-diff14.8%
exp-diff71.6%
sub-neg71.6%
remove-double-neg71.6%
fabs-sub71.6%
Simplified71.6%
Taylor expanded in K around 0 96.1%
cos-neg96.1%
Simplified96.1%
Taylor expanded in m around 0 69.2%
+-commutative69.2%
unpow269.2%
distribute-rgt-out73.0%
*-commutative73.0%
*-commutative73.0%
Simplified73.0%
Taylor expanded in m around inf 40.1%
Taylor expanded in M around inf 41.5%
if -1.3000000000000001e-305 < l < 1.10000000000000003e-42Initial program 86.8%
associate-/l*86.8%
exp-diff22.7%
sub-neg22.7%
exp-sum22.7%
associate-/r*22.7%
exp-diff22.7%
exp-diff86.8%
sub-neg86.8%
remove-double-neg86.8%
fabs-sub86.8%
Simplified86.8%
Taylor expanded in K around 0 98.4%
cos-neg98.4%
Simplified98.4%
Taylor expanded in m around 0 76.0%
+-commutative76.0%
unpow276.0%
distribute-rgt-out81.7%
*-commutative81.7%
*-commutative81.7%
Simplified81.7%
Taylor expanded in m around inf 50.4%
Taylor expanded in M around 0 41.5%
Final simplification53.3%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (cos M) (exp (- l)))) (t_1 (* (cos M) (exp (* M m)))))
(if (<= l -1.52e+267)
t_0
(if (<= l -2.65e+41)
(pow (exp m) (* n -0.5))
(if (<= l -5.2e-300)
t_1
(if (<= l 1.65e-42)
(* (cos M) (exp (* m (* n -0.5))))
(if (<= l 1.5e-12) t_1 t_0)))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(M) * exp(-l);
double t_1 = cos(M) * exp((M * m));
double tmp;
if (l <= -1.52e+267) {
tmp = t_0;
} else if (l <= -2.65e+41) {
tmp = pow(exp(m), (n * -0.5));
} else if (l <= -5.2e-300) {
tmp = t_1;
} else if (l <= 1.65e-42) {
tmp = cos(M) * exp((m * (n * -0.5)));
} else if (l <= 1.5e-12) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_0 = cos(m_1) * exp(-l)
t_1 = cos(m_1) * exp((m_1 * m))
if (l <= (-1.52d+267)) then
tmp = t_0
else if (l <= (-2.65d+41)) then
tmp = exp(m) ** (n * (-0.5d0))
else if (l <= (-5.2d-300)) then
tmp = t_1
else if (l <= 1.65d-42) then
tmp = cos(m_1) * exp((m * (n * (-0.5d0))))
else if (l <= 1.5d-12) then
tmp = t_1
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.cos(M) * Math.exp(-l);
double t_1 = Math.cos(M) * Math.exp((M * m));
double tmp;
if (l <= -1.52e+267) {
tmp = t_0;
} else if (l <= -2.65e+41) {
tmp = Math.pow(Math.exp(m), (n * -0.5));
} else if (l <= -5.2e-300) {
tmp = t_1;
} else if (l <= 1.65e-42) {
tmp = Math.cos(M) * Math.exp((m * (n * -0.5)));
} else if (l <= 1.5e-12) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(M) * math.exp(-l) t_1 = math.cos(M) * math.exp((M * m)) tmp = 0 if l <= -1.52e+267: tmp = t_0 elif l <= -2.65e+41: tmp = math.pow(math.exp(m), (n * -0.5)) elif l <= -5.2e-300: tmp = t_1 elif l <= 1.65e-42: tmp = math.cos(M) * math.exp((m * (n * -0.5))) elif l <= 1.5e-12: tmp = t_1 else: tmp = t_0 return tmp
function code(K, m, n, M, l) t_0 = Float64(cos(M) * exp(Float64(-l))) t_1 = Float64(cos(M) * exp(Float64(M * m))) tmp = 0.0 if (l <= -1.52e+267) tmp = t_0; elseif (l <= -2.65e+41) tmp = exp(m) ^ Float64(n * -0.5); elseif (l <= -5.2e-300) tmp = t_1; elseif (l <= 1.65e-42) tmp = Float64(cos(M) * exp(Float64(m * Float64(n * -0.5)))); elseif (l <= 1.5e-12) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(M) * exp(-l); t_1 = cos(M) * exp((M * m)); tmp = 0.0; if (l <= -1.52e+267) tmp = t_0; elseif (l <= -2.65e+41) tmp = exp(m) ^ (n * -0.5); elseif (l <= -5.2e-300) tmp = t_1; elseif (l <= 1.65e-42) tmp = cos(M) * exp((m * (n * -0.5))); elseif (l <= 1.5e-12) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.52e+267], t$95$0, If[LessEqual[l, -2.65e+41], N[Power[N[Exp[m], $MachinePrecision], N[(n * -0.5), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, -5.2e-300], t$95$1, If[LessEqual[l, 1.65e-42], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(m * N[(n * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.5e-12], t$95$1, t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos M \cdot e^{-\ell}\\
t_1 := \cos M \cdot e^{M \cdot m}\\
\mathbf{if}\;\ell \leq -1.52 \cdot 10^{+267}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -2.65 \cdot 10^{+41}:\\
\;\;\;\;{\left(e^{m}\right)}^{\left(n \cdot -0.5\right)}\\
\mathbf{elif}\;\ell \leq -5.2 \cdot 10^{-300}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 1.65 \cdot 10^{-42}:\\
\;\;\;\;\cos M \cdot e^{m \cdot \left(n \cdot -0.5\right)}\\
\mathbf{elif}\;\ell \leq 1.5 \cdot 10^{-12}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -1.5199999999999999e267 or 1.5000000000000001e-12 < l Initial program 80.3%
associate-/l*80.3%
exp-diff55.3%
sub-neg55.3%
exp-sum30.3%
associate-/r*30.3%
exp-diff31.6%
exp-diff80.3%
sub-neg80.3%
remove-double-neg80.3%
fabs-sub80.3%
Simplified80.3%
Taylor expanded in K around 0 99.6%
cos-neg99.6%
Simplified99.6%
Taylor expanded in l around inf 91.9%
neg-mul-191.9%
Simplified91.9%
if -1.5199999999999999e267 < l < -2.6499999999999998e41Initial program 69.6%
associate-/l*69.6%
exp-diff6.5%
sub-neg6.5%
exp-sum6.5%
associate-/r*6.5%
exp-diff23.9%
exp-diff69.6%
sub-neg69.6%
remove-double-neg69.6%
fabs-sub69.6%
Simplified69.6%
Taylor expanded in K around 0 95.7%
cos-neg95.7%
Simplified95.7%
Taylor expanded in m around 0 67.7%
+-commutative67.7%
unpow267.7%
distribute-rgt-out74.3%
*-commutative74.3%
*-commutative74.3%
Simplified74.3%
Taylor expanded in m around inf 40.6%
Taylor expanded in M around 0 32.2%
*-commutative32.2%
associate-*r*32.2%
exp-prod23.7%
*-commutative23.7%
Simplified23.7%
if -2.6499999999999998e41 < l < -5.19999999999999993e-300 or 1.6500000000000001e-42 < l < 1.5000000000000001e-12Initial program 71.3%
associate-/l*71.6%
exp-diff12.3%
sub-neg12.3%
exp-sum12.3%
associate-/r*12.3%
exp-diff14.8%
exp-diff71.6%
sub-neg71.6%
remove-double-neg71.6%
fabs-sub71.6%
Simplified71.6%
Taylor expanded in K around 0 96.1%
cos-neg96.1%
Simplified96.1%
Taylor expanded in m around 0 69.2%
+-commutative69.2%
unpow269.2%
distribute-rgt-out73.0%
*-commutative73.0%
*-commutative73.0%
Simplified73.0%
Taylor expanded in m around inf 40.1%
Taylor expanded in M around inf 41.5%
if -5.19999999999999993e-300 < l < 1.6500000000000001e-42Initial program 86.8%
associate-/l*86.8%
exp-diff22.7%
sub-neg22.7%
exp-sum22.7%
associate-/r*22.7%
exp-diff22.7%
exp-diff86.8%
sub-neg86.8%
remove-double-neg86.8%
fabs-sub86.8%
Simplified86.8%
Taylor expanded in K around 0 98.4%
cos-neg98.4%
Simplified98.4%
Taylor expanded in m around 0 76.0%
+-commutative76.0%
unpow276.0%
distribute-rgt-out81.7%
*-commutative81.7%
*-commutative81.7%
Simplified81.7%
Taylor expanded in m around inf 50.4%
Taylor expanded in M around 0 41.5%
*-commutative41.5%
associate-*r*41.5%
*-commutative41.5%
Simplified41.5%
Final simplification53.3%
(FPCore (K m n M l) :precision binary64 (if (<= l 1.5e-12) (* (cos M) (exp (* m (- M (* n 0.5))))) (* (cos M) (exp (- l)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= 1.5e-12) {
tmp = cos(M) * exp((m * (M - (n * 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.5d-12) then
tmp = cos(m_1) * exp((m * (m_1 - (n * 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.5e-12) {
tmp = Math.cos(M) * Math.exp((m * (M - (n * 0.5))));
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= 1.5e-12: tmp = math.cos(M) * math.exp((m * (M - (n * 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.5e-12) tmp = Float64(cos(M) * exp(Float64(m * Float64(M - Float64(n * 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.5e-12) tmp = cos(M) * exp((m * (M - (n * 0.5)))); else tmp = cos(M) * exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, 1.5e-12], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(m * N[(M - N[(n * 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.5 \cdot 10^{-12}:\\
\;\;\;\;\cos M \cdot e^{m \cdot \left(M - n \cdot 0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if l < 1.5000000000000001e-12Initial program 75.2%
associate-/l*75.2%
exp-diff14.7%
sub-neg14.7%
exp-sum14.7%
associate-/r*14.7%
exp-diff20.5%
exp-diff75.2%
sub-neg75.2%
remove-double-neg75.2%
fabs-sub75.2%
Simplified75.2%
Taylor expanded in K around 0 96.8%
cos-neg96.8%
Simplified96.8%
Taylor expanded in m around 0 71.3%
+-commutative71.3%
unpow271.3%
distribute-rgt-out76.1%
*-commutative76.1%
*-commutative76.1%
Simplified76.1%
Taylor expanded in m around inf 42.7%
if 1.5000000000000001e-12 < l Initial program 81.8%
associate-/l*81.8%
exp-diff59.1%
sub-neg59.1%
exp-sum30.3%
associate-/r*30.3%
exp-diff30.3%
exp-diff81.8%
sub-neg81.8%
remove-double-neg81.8%
fabs-sub81.8%
Simplified81.8%
Taylor expanded in K around 0 99.6%
cos-neg99.6%
Simplified99.6%
Taylor expanded in l around inf 98.1%
neg-mul-198.1%
Simplified98.1%
Final simplification56.9%
(FPCore (K m n M l) :precision binary64 (if (or (<= l -1.6e+262) (not (<= l 3.4e-14))) (* (cos M) (exp (- l))) (exp (* -0.5 (* m n)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((l <= -1.6e+262) || !(l <= 3.4e-14)) {
tmp = cos(M) * exp(-l);
} else {
tmp = exp((-0.5 * (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 ((l <= (-1.6d+262)) .or. (.not. (l <= 3.4d-14))) then
tmp = cos(m_1) * exp(-l)
else
tmp = exp(((-0.5d0) * (m * n)))
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.6e+262) || !(l <= 3.4e-14)) {
tmp = Math.cos(M) * Math.exp(-l);
} else {
tmp = Math.exp((-0.5 * (m * n)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (l <= -1.6e+262) or not (l <= 3.4e-14): tmp = math.cos(M) * math.exp(-l) else: tmp = math.exp((-0.5 * (m * n))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((l <= -1.6e+262) || !(l <= 3.4e-14)) tmp = Float64(cos(M) * exp(Float64(-l))); else tmp = exp(Float64(-0.5 * Float64(m * n))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((l <= -1.6e+262) || ~((l <= 3.4e-14))) tmp = cos(M) * exp(-l); else tmp = exp((-0.5 * (m * n))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[l, -1.6e+262], N[Not[LessEqual[l, 3.4e-14]], $MachinePrecision]], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], N[Exp[N[(-0.5 * N[(m * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.6 \cdot 10^{+262} \lor \neg \left(\ell \leq 3.4 \cdot 10^{-14}\right):\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\mathbf{else}:\\
\;\;\;\;e^{-0.5 \cdot \left(m \cdot n\right)}\\
\end{array}
\end{array}
if l < -1.5999999999999999e262 or 3.40000000000000003e-14 < l Initial program 78.8%
associate-/l*78.8%
exp-diff52.5%
sub-neg52.5%
exp-sum28.8%
associate-/r*28.8%
exp-diff30.0%
exp-diff78.8%
sub-neg78.8%
remove-double-neg78.8%
fabs-sub78.8%
Simplified78.8%
Taylor expanded in K around 0 99.6%
cos-neg99.6%
Simplified99.6%
Taylor expanded in l around inf 88.6%
neg-mul-188.6%
Simplified88.6%
if -1.5999999999999999e262 < l < 3.40000000000000003e-14Initial program 76.0%
associate-/l*76.1%
exp-diff14.2%
sub-neg14.2%
exp-sum14.2%
associate-/r*14.2%
exp-diff19.9%
exp-diff76.1%
sub-neg76.1%
remove-double-neg76.1%
fabs-sub76.1%
Simplified76.1%
Taylor expanded in K around 0 96.6%
cos-neg96.6%
Simplified96.6%
Taylor expanded in m around 0 70.2%
+-commutative70.2%
unpow270.2%
distribute-rgt-out75.3%
*-commutative75.3%
*-commutative75.3%
Simplified75.3%
Taylor expanded in m around inf 43.6%
Taylor expanded in M around 0 32.7%
Final simplification50.2%
(FPCore (K m n M l) :precision binary64 (if (or (<= l -4.4e+269) (not (<= l 1.5e-12))) (* (cos M) (exp (- l))) (pow (exp m) (* n -0.5))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((l <= -4.4e+269) || !(l <= 1.5e-12)) {
tmp = cos(M) * exp(-l);
} else {
tmp = pow(exp(m), (n * -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 ((l <= (-4.4d+269)) .or. (.not. (l <= 1.5d-12))) then
tmp = cos(m_1) * exp(-l)
else
tmp = exp(m) ** (n * (-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 ((l <= -4.4e+269) || !(l <= 1.5e-12)) {
tmp = Math.cos(M) * Math.exp(-l);
} else {
tmp = Math.pow(Math.exp(m), (n * -0.5));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (l <= -4.4e+269) or not (l <= 1.5e-12): tmp = math.cos(M) * math.exp(-l) else: tmp = math.pow(math.exp(m), (n * -0.5)) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((l <= -4.4e+269) || !(l <= 1.5e-12)) tmp = Float64(cos(M) * exp(Float64(-l))); else tmp = exp(m) ^ Float64(n * -0.5); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((l <= -4.4e+269) || ~((l <= 1.5e-12))) tmp = cos(M) * exp(-l); else tmp = exp(m) ^ (n * -0.5); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[l, -4.4e+269], N[Not[LessEqual[l, 1.5e-12]], $MachinePrecision]], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], N[Power[N[Exp[m], $MachinePrecision], N[(n * -0.5), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.4 \cdot 10^{+269} \lor \neg \left(\ell \leq 1.5 \cdot 10^{-12}\right):\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\mathbf{else}:\\
\;\;\;\;{\left(e^{m}\right)}^{\left(n \cdot -0.5\right)}\\
\end{array}
\end{array}
if l < -4.3999999999999997e269 or 1.5000000000000001e-12 < l Initial program 80.0%
associate-/l*80.0%
exp-diff56.0%
sub-neg56.0%
exp-sum30.7%
associate-/r*30.7%
exp-diff32.0%
exp-diff80.0%
sub-neg80.0%
remove-double-neg80.0%
fabs-sub80.0%
Simplified80.0%
Taylor expanded in K around 0 99.6%
cos-neg99.6%
Simplified99.6%
Taylor expanded in l around inf 93.1%
neg-mul-193.1%
Simplified93.1%
if -4.3999999999999997e269 < l < 1.5000000000000001e-12Initial program 75.6%
associate-/l*75.7%
exp-diff13.8%
sub-neg13.8%
exp-sum13.8%
associate-/r*13.8%
exp-diff19.3%
exp-diff75.7%
sub-neg75.7%
remove-double-neg75.7%
fabs-sub75.7%
Simplified75.7%
Taylor expanded in K around 0 96.7%
cos-neg96.7%
Simplified96.7%
Taylor expanded in m around 0 71.0%
+-commutative71.0%
unpow271.0%
distribute-rgt-out76.0%
*-commutative76.0%
*-commutative76.0%
Simplified76.0%
Taylor expanded in m around inf 43.6%
Taylor expanded in M around 0 31.9%
*-commutative31.9%
associate-*r*31.9%
exp-prod28.6%
*-commutative28.6%
Simplified28.6%
Final simplification47.5%
(FPCore (K m n M l) :precision binary64 (exp (* -0.5 (* m n))))
double code(double K, double m, double n, double M, double l) {
return exp((-0.5 * (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 = exp(((-0.5d0) * (m * n)))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.exp((-0.5 * (m * n)));
}
def code(K, m, n, M, l): return math.exp((-0.5 * (m * n)))
function code(K, m, n, M, l) return exp(Float64(-0.5 * Float64(m * n))) end
function tmp = code(K, m, n, M, l) tmp = exp((-0.5 * (m * n))); end
code[K_, m_, n_, M_, l_] := N[Exp[N[(-0.5 * N[(m * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{-0.5 \cdot \left(m \cdot n\right)}
\end{array}
Initial program 76.9%
associate-/l*76.9%
exp-diff26.2%
sub-neg26.2%
exp-sum18.7%
associate-/r*18.7%
exp-diff23.0%
exp-diff76.9%
sub-neg76.9%
remove-double-neg76.9%
fabs-sub76.9%
Simplified76.9%
Taylor expanded in K around 0 97.5%
cos-neg97.5%
Simplified97.5%
Taylor expanded in m around 0 74.7%
+-commutative74.7%
unpow274.7%
distribute-rgt-out80.2%
*-commutative80.2%
*-commutative80.2%
Simplified80.2%
Taylor expanded in m around inf 39.0%
Taylor expanded in M around 0 28.9%
Final simplification28.9%
herbie shell --seed 2023318
(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)))))))