15 #ifndef __pseudometafunc_h
16 #define __pseudometafunc_h
64 template<
unsigned M,
unsigned N,
unsigned B,
unsigned A>
66 static long double value() {
67 return 1-(A*M_PI/B)*(A*M_PI/B)/M/(M+1)
72 template<
unsigned N,
unsigned B,
unsigned A>
74 static long double value() {
return 1.; }
88 template<
unsigned B,
unsigned A,
typename T=
double>
91 template<
unsigned B,
unsigned A>
92 struct Sin<B,A,float> {
93 static float value() {
98 template<
unsigned B,
unsigned A>
99 struct Sin<B,A,double> {
100 static double value() {
101 return (A*M_PI/B)*SinCosSeries<2,34,B,A>::value();
105 template<
unsigned B,
unsigned A>
106 struct Sin<B,A,long double> {
107 static long double value() {
108 return (A*M_PI/B)*SinCosSeries<2,60,B,A>::value();
121 template<
unsigned B,
unsigned A,
typename T=
double>
124 template<
unsigned B,
unsigned A>
125 struct Cos<B,A,float> {
126 static float value() {
131 template<
unsigned B,
unsigned A>
132 struct Cos<B,A,double> {
133 static double value() {
134 return SinCosSeries<1,33,B,A>::value();
138 template<
unsigned B,
unsigned A>
139 struct Cos<B,A,long double> {
140 static long double value() {
141 return SinCosSeries<1,59,B,A>::value();
146 template<
unsigned N,
unsigned I>
149 static long double value() {
150 static const long double XI = SqrtSeries<N,I-1>::value();
151 return 0.5*(XI + N/XI);
156 class SqrtSeries<N,0> {
157 static const unsigned ND = NDigits<N, 2>::value;
158 static const unsigned X0 = IPow<2, ND/2>::value;
160 static long double value() {
161 return 0.5*(X0 + N/
static_cast<long double>(X0));
165 template<
unsigned N,
typename T=
double>
169 struct Sqrt<N, float> {
170 static float value() {
171 return SqrtSeries<N,5>::value();
176 struct Sqrt<N, double> {
177 static double value() {
178 return SqrtSeries<N,6>::value();
183 struct Sqrt<N, long double> {
184 static long double value() {
185 return SqrtSeries<N,6>::value();
194 static const unsigned long P16 = IPow<16,K>::value;
195 static const int_t K1 = 8*K+1;
196 static const int_t K2 = 4*K+2;
197 static const int_t K3 = 8*K+5;
198 static const int_t K4 = 8*K+6;
203 return (4./static_cast<T>(K1) - 2./static_cast<T>(K2) - 1./static_cast<T>(K3) - 1./static_cast<T>(K4))
204 /
static_cast<T
>(P16) + Pi<K-1>::value();
211 static double value() {
return 47./15.; }