]> www.ginac.de Git - cln.git/blob - src/float/transcendental/cl_F_roundpi2.cc
9503a779652eb8df94e36836132dcbda29c92c8a
[cln.git] / src / float / transcendental / cl_F_roundpi2.cc
1 // cl_round_pi2().
2
3 // General includes.
4 #include "cl_sysdep.h"
5
6 // Specification.
7 #include "cl_F_tran.h"
8
9
10 // Implementation.
11
12 const cl_F_div_t cl_round_pi2 (const cl_F& x)
13 {
14         if (float_exponent(x) < 0)
15                 // Exponent <0 -> |x|<1/2 -> |x/(pi/2)| < 1/2, also Division unnötig
16                 return cl_F_div_t(0,x); // Quotient 0, Rest x
17         else
18                 // x durch pi/2 (mit hinreichender Genauigkeit) dividieren
19                 return round2(x,scale_float(cl_pi(x),-1));
20 }