X-Git-Url: https://ginac.de/CLN/cln.git//cln.git?a=blobdiff_plain;f=src%2Ffloat%2Ftranscendental%2Fcl_LF_cossin_aux.cc;h=74977f22eb2318ed5911da2ca2f19293356cdee8;hb=3af2cde18b3aabed4c808b0113daa81c2263b0bd;hp=83dafa3249ae897a40da6ee182a9511c1a7edef6;hpb=c486b78a1a0613f07a10816d6f6ca9e485bc8290;p=cln.git diff --git a/src/float/transcendental/cl_LF_cossin_aux.cc b/src/float/transcendental/cl_LF_cossin_aux.cc index 83dafa3..74977f2 100644 --- a/src/float/transcendental/cl_LF_cossin_aux.cc +++ b/src/float/transcendental/cl_LF_cossin_aux.cc @@ -1,19 +1,19 @@ // cl_cossin_aux(). // General includes. -#include "cl_sysdep.h" +#include "base/cl_sysdep.h" // Specification. -#include "cl_F_tran.h" +#include "float/transcendental/cl_F_tran.h" // Implementation. #include "cln/lfloat.h" -#include "cl_LF_tran.h" -#include "cl_LF.h" +#include "float/transcendental/cl_LF_tran.h" +#include "float/lfloat/cl_LF.h" #include "cln/integer.h" -#include "cl_alloca.h" +#include "base/cl_alloca.h" #include "cln/exception.h" #undef floor @@ -52,8 +52,8 @@ const cl_LF_cos_sin_t cl_cossin_aux (const cl_I& p, uintE lq, uintC len) // a(n) = 1, b(n) = 1, // p(0) = p, p(n) = -p^2 for n>0, // q(0) = 2^lq, q(n) = (2*n)*(2*n+1)*(2^lq)^2 for n>0. - var uintC actuallen = len+1; // 1 Schutz-Digit - // How many terms to we need for M bits of precision? N/2 terms suffice, + var uintC actuallen = len+1; // 1 guard digit + // How many terms do we need for M bits of precision? N/2 terms suffice, // provided that // 1/(2^(N*lp)*N!) < 2^-M // <== N*(log(N)-1)+N*lp*log(2) > M*log(2) @@ -73,7 +73,6 @@ const cl_LF_cos_sin_t cl_cossin_aux (const cl_I& p, uintE lq, uintC len) CL_ALLOCA_STACK; var cl_I* pv = (cl_I*) cl_alloca(N*sizeof(cl_I)); var cl_I* qv = (cl_I*) cl_alloca(N*sizeof(cl_I)); - var uintC* qsv = (uintC*) cl_alloca(N*sizeof(uintC)); var uintC n; var cl_I p2 = -square(p); var cl_LF sinsum; @@ -85,8 +84,8 @@ const cl_LF_cos_sin_t cl_cossin_aux (const cl_I& p, uintE lq, uintC len) init1(cl_I, qv[n]) (((cl_I)n*(cl_I)(2*n+1)) << (2*lq+1)); } var cl_pq_series series; - series.pv = pv; series.qv = qv; series.qsv = qsv; - sinsum = eval_rational_series(N,series,actuallen); + series.pv = pv; series.qv = qv; + sinsum = eval_rational_series(N,series,actuallen); for (n = 0; n < N; n++) { pv[n].~cl_I(); qv[n].~cl_I(); @@ -102,8 +101,8 @@ const cl_LF_cos_sin_t cl_cossin_aux (const cl_I& p, uintE lq, uintC len) init1(cl_I, qv[n]) (((cl_I)n*(cl_I)(2*n-1)) << (2*lq+1)); } var cl_pq_series series; - series.pv = pv; series.qv = qv; series.qsv = qsv; - cossum = eval_rational_series(N,series,actuallen); + series.pv = pv; series.qv = qv; + cossum = eval_rational_series(N,series,actuallen); for (n = 0; n < N; n++) { pv[n].~cl_I(); qv[n].~cl_I(); @@ -112,7 +111,7 @@ const cl_LF_cos_sin_t cl_cossin_aux (const cl_I& p, uintE lq, uintC len) #else // TRIVIAL_SPEEDUP var cl_LF cossum = sqrt(cl_I_to_LF(1,actuallen) - square(sinsum)); #endif - return cl_LF_cos_sin_t(shorten(cossum,len),shorten(sinsum,len)); // verkürzen und fertig + return cl_LF_cos_sin_t(shorten(cossum,len),shorten(sinsum,len)); // verkürzen und fertig }} // Bit complexity (N = len, and if p has length O(log N) and ql = O(log N)): // O(log(N)*M(N)).