X-Git-Url: https://ginac.de/CLN/cln.git//cln.git?a=blobdiff_plain;f=src%2Ffloat%2Ftranscendental%2Fcl_F_cossin.cc;h=486bacdf5fcd77a70e7f97fef8ab0e9c0461b1e6;hb=c84c6db5d56829d69083c819688a973867694a2a;hp=8283a5c413a3d91e1803bc549c347fecee6c159f;hpb=dd9e0f894eec7e2a8cf85078330ddc0a6639090b;p=cln.git diff --git a/src/float/transcendental/cl_F_cossin.cc b/src/float/transcendental/cl_F_cossin.cc index 8283a5c..486bacd 100644 --- a/src/float/transcendental/cl_F_cossin.cc +++ b/src/float/transcendental/cl_F_cossin.cc @@ -1,21 +1,23 @@ -// cl_cos_sin(). +// cos_sin(). // General includes. #include "cl_sysdep.h" // Specification. -#include "cl_float.h" +#include "cln/float.h" // Implementation. #include "cl_F_tran.h" #include "cl_F.h" -#include "cl_integer.h" -#include "cl_lfloat.h" +#include "cln/integer.h" +#include "cln/lfloat.h" #include "cl_LF.h" -const cl_cos_sin_t cl_cos_sin (const cl_F& x) +namespace cln { + +const cos_sin_t cos_sin (const cl_F& x) { // Methode: // Genauigkeit erhöhen, @@ -54,7 +56,7 @@ const cl_cos_sin_t cl_cos_sin (const cl_F& x) var cl_LF r = The(cl_LF)(q_r.remainder); var cl_LF y = sinx_naive(r); // y := sin(r)^2 // erste Komponente cos(r) berechnen: - if (zerop(r) || (float_exponent(r) <= (-(sintL)float_digits(r))>>1)) + if (zerop(r) || (float_exponent(r) <= (-(sintC)float_digits(r))>>1)) cos_r = cl_float(1,x); // cos(r) = 1.0 else cos_r = cl_float(sqrt(1-y),x); // cos(r) = sqrt(1-y) @@ -69,7 +71,7 @@ const cl_cos_sin_t cl_cos_sin (const cl_F& x) var cl_F& r = q_r.remainder; var cl_F y = sinxbyx_naive(r); // y := (sin(r)/r)^2 // erste Komponente cos(r) berechnen: - if (zerop(r) || (float_exponent(r) <= (-(sintL)float_digits(r))>>1)) + if (zerop(r) || (float_exponent(r) <= (-(sintC)float_digits(r))>>1)) cos_r = cl_float(1,x); // cos(r) = 1.0 else cos_r = cl_float(sqrt(1 - square(r)*y),x); // sqrt(1-r^2*y) @@ -78,10 +80,12 @@ const cl_cos_sin_t cl_cos_sin (const cl_F& x) } // evtl. Vorzeichenwechsel oder Vertauschen: switch (cl_I_to_UL(logand(q,3))) { // q mod 4 - case 0: return cl_cos_sin_t(cos_r,sin_r); - case 1: return cl_cos_sin_t(-sin_r,cos_r); - case 2: return cl_cos_sin_t(-cos_r,-sin_r); - case 3: return cl_cos_sin_t(sin_r,-cos_r); + case 0: return cos_sin_t(cos_r,sin_r); + case 1: return cos_sin_t(-sin_r,cos_r); + case 2: return cos_sin_t(-cos_r,-sin_r); + case 3: return cos_sin_t(sin_r,-cos_r); default: NOTREACHED } } + +} // namespace cln