| [221] | 1 | // Generated: genmathfunc.cpp Jul 28 1998 17:29:02
 | 
|---|
 | 2 | 
 | 
|---|
 | 3 | #ifndef BZ_MATHFUNC_H
 | 
|---|
 | 4 | #define BZ_MATHFUNC_H
 | 
|---|
 | 5 | 
 | 
|---|
 | 6 | #ifndef BZ_APPLICS_H
 | 
|---|
 | 7 |  #error <blitz/mathfunc.h> should be included via <blitz/applics.h>
 | 
|---|
 | 8 | #endif
 | 
|---|
 | 9 | 
 | 
|---|
 | 10 | 
 | 
|---|
 | 11 | #ifndef BZ_PRETTYPRINT_H
 | 
|---|
 | 12 |  #include <blitz/prettyprint.h>
 | 
|---|
 | 13 | #endif
 | 
|---|
 | 14 | 
 | 
|---|
 | 15 | BZ_NAMESPACE(blitz)
 | 
|---|
 | 16 | 
 | 
|---|
 | 17 | // abs(P_numtype1)    Absolute value
 | 
|---|
 | 18 | template<class P_numtype1>
 | 
|---|
 | 19 | class _bz_abs : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 20 | public:
 | 
|---|
 | 21 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 22 |     typedef P_numtype1 T_numtype;
 | 
|---|
 | 23 | 
 | 
|---|
 | 24 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 25 |     { return BZ_MATHFN_SCOPE(abs)(x); }
 | 
|---|
 | 26 | 
 | 
|---|
 | 27 |     template<class T1>
 | 
|---|
 | 28 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 29 |         const T1& a)
 | 
|---|
 | 30 |     {
 | 
|---|
 | 31 |         str += "abs(";
 | 
|---|
 | 32 |         a.prettyPrint(str,format);
 | 
|---|
 | 33 |         str += ")";
 | 
|---|
 | 34 |     }
 | 
|---|
 | 35 | };
 | 
|---|
 | 36 | 
 | 
|---|
 | 37 | // abs(long)
 | 
|---|
 | 38 | template<>
 | 
|---|
 | 39 | class _bz_abs<long> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 40 | public:
 | 
|---|
 | 41 |     typedef long T_numtype1;
 | 
|---|
 | 42 |     typedef long T_numtype;
 | 
|---|
 | 43 | 
 | 
|---|
 | 44 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 45 |     { return BZ_MATHFN_SCOPE(labs)((long)x); }
 | 
|---|
 | 46 | 
 | 
|---|
 | 47 |     template<class T1>
 | 
|---|
 | 48 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 49 |         const T1& a)
 | 
|---|
 | 50 |     {
 | 
|---|
 | 51 |         str += "labs(";
 | 
|---|
 | 52 |         a.prettyPrint(str,format);
 | 
|---|
 | 53 |         str += ")";
 | 
|---|
 | 54 |     }
 | 
|---|
 | 55 | };
 | 
|---|
 | 56 | 
 | 
|---|
 | 57 | // abs(float)
 | 
|---|
 | 58 | template<>
 | 
|---|
 | 59 | class _bz_abs<float> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 60 | public:
 | 
|---|
 | 61 |     typedef float T_numtype1;
 | 
|---|
 | 62 |     typedef float T_numtype;
 | 
|---|
 | 63 | 
 | 
|---|
 | 64 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 65 |     { return BZ_MATHFN_SCOPE(fabs)((float)x); }
 | 
|---|
 | 66 | 
 | 
|---|
 | 67 |     template<class T1>
 | 
|---|
 | 68 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 69 |         const T1& a)
 | 
|---|
 | 70 |     {
 | 
|---|
 | 71 |         str += "fabs(";
 | 
|---|
 | 72 |         a.prettyPrint(str,format);
 | 
|---|
 | 73 |         str += ")";
 | 
|---|
 | 74 |     }
 | 
|---|
 | 75 | };
 | 
|---|
 | 76 | 
 | 
|---|
 | 77 | // abs(double)
 | 
|---|
 | 78 | template<>
 | 
|---|
 | 79 | class _bz_abs<double> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 80 | public:
 | 
|---|
 | 81 |     typedef double T_numtype1;
 | 
|---|
 | 82 |     typedef double T_numtype;
 | 
|---|
 | 83 | 
 | 
|---|
 | 84 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 85 |     { return BZ_MATHFN_SCOPE(fabs)((double)x); }
 | 
|---|
 | 86 | 
 | 
|---|
 | 87 |     template<class T1>
 | 
|---|
 | 88 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 89 |         const T1& a)
 | 
|---|
 | 90 |     {
 | 
|---|
 | 91 |         str += "fabs(";
 | 
|---|
 | 92 |         a.prettyPrint(str,format);
 | 
|---|
 | 93 |         str += ")";
 | 
|---|
 | 94 |     }
 | 
|---|
 | 95 | };
 | 
|---|
 | 96 | 
 | 
|---|
 | 97 | // abs(long double)
 | 
|---|
 | 98 | template<>
 | 
|---|
 | 99 | class _bz_abs<long double> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 100 | public:
 | 
|---|
 | 101 |     typedef long double T_numtype1;
 | 
|---|
 | 102 |     typedef long double T_numtype;
 | 
|---|
 | 103 | 
 | 
|---|
 | 104 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 105 |     { return BZ_MATHFN_SCOPE(fabs)((long double)x); }
 | 
|---|
 | 106 | 
 | 
|---|
 | 107 |     template<class T1>
 | 
|---|
 | 108 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 109 |         const T1& a)
 | 
|---|
 | 110 |     {
 | 
|---|
 | 111 |         str += "fabs(";
 | 
|---|
 | 112 |         a.prettyPrint(str,format);
 | 
|---|
 | 113 |         str += ")";
 | 
|---|
 | 114 |     }
 | 
|---|
 | 115 | };
 | 
|---|
 | 116 | 
 | 
|---|
 | 117 | // acos(P_numtype1)    Inverse cosine
 | 
|---|
 | 118 | template<class P_numtype1>
 | 
|---|
 | 119 | class _bz_acos : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 120 | public:
 | 
|---|
 | 121 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 122 |     typedef double T_numtype;
 | 
|---|
 | 123 | 
 | 
|---|
 | 124 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 125 |     { return BZ_MATHFN_SCOPE(acos)((double)x); }
 | 
|---|
 | 126 | 
 | 
|---|
 | 127 |     template<class T1>
 | 
|---|
 | 128 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 129 |         const T1& a)
 | 
|---|
 | 130 |     {
 | 
|---|
 | 131 |         str += "acos(";
 | 
|---|
 | 132 |         a.prettyPrint(str,format);
 | 
|---|
 | 133 |         str += ")";
 | 
|---|
 | 134 |     }
 | 
|---|
 | 135 | };
 | 
|---|
 | 136 | 
 | 
|---|
 | 137 | // acos(float)
 | 
|---|
 | 138 | template<>
 | 
|---|
 | 139 | class _bz_acos<float> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 140 | public:
 | 
|---|
 | 141 |     typedef float T_numtype1;
 | 
|---|
 | 142 |     typedef float T_numtype;
 | 
|---|
 | 143 | 
 | 
|---|
 | 144 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 145 |     { return BZ_MATHFN_SCOPE(acos)((float)x); }
 | 
|---|
 | 146 | 
 | 
|---|
 | 147 |     template<class T1>
 | 
|---|
 | 148 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 149 |         const T1& a)
 | 
|---|
 | 150 |     {
 | 
|---|
 | 151 |         str += "acos(";
 | 
|---|
 | 152 |         a.prettyPrint(str,format);
 | 
|---|
 | 153 |         str += ")";
 | 
|---|
 | 154 |     }
 | 
|---|
 | 155 | };
 | 
|---|
 | 156 | 
 | 
|---|
 | 157 | // acos(long double)
 | 
|---|
 | 158 | template<>
 | 
|---|
 | 159 | class _bz_acos<long double> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 160 | public:
 | 
|---|
 | 161 |     typedef long double T_numtype1;
 | 
|---|
 | 162 |     typedef long double T_numtype;
 | 
|---|
 | 163 | 
 | 
|---|
 | 164 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 165 |     { return BZ_MATHFN_SCOPE(acos)((long double)x); }
 | 
|---|
 | 166 | 
 | 
|---|
 | 167 |     template<class T1>
 | 
|---|
 | 168 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 169 |         const T1& a)
 | 
|---|
 | 170 |     {
 | 
|---|
 | 171 |         str += "acos(";
 | 
|---|
 | 172 |         a.prettyPrint(str,format);
 | 
|---|
 | 173 |         str += ")";
 | 
|---|
 | 174 |     }
 | 
|---|
 | 175 | };
 | 
|---|
 | 176 | 
 | 
|---|
 | 177 | // acos(complex<float> )
 | 
|---|
 | 178 | #ifdef BZ_HAVE_COMPLEX_MATH2
 | 
|---|
 | 179 | template<>
 | 
|---|
 | 180 | class _bz_acos<complex<float> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 181 | public:
 | 
|---|
 | 182 |     typedef complex<float>  T_numtype1;
 | 
|---|
 | 183 |     typedef complex<float> T_numtype;
 | 
|---|
 | 184 | 
 | 
|---|
 | 185 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 186 |     { return BZ_CMATHFN_SCOPE(acos)((complex<float> )x); }
 | 
|---|
 | 187 | 
 | 
|---|
 | 188 |     template<class T1>
 | 
|---|
 | 189 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 190 |         const T1& a)
 | 
|---|
 | 191 |     {
 | 
|---|
 | 192 |         str += "acos(";
 | 
|---|
 | 193 |         a.prettyPrint(str,format);
 | 
|---|
 | 194 |         str += ")";
 | 
|---|
 | 195 |     }
 | 
|---|
 | 196 | };
 | 
|---|
 | 197 | #endif
 | 
|---|
 | 198 | 
 | 
|---|
 | 199 | // acos(complex<double> )
 | 
|---|
 | 200 | #ifdef BZ_HAVE_COMPLEX_MATH2
 | 
|---|
 | 201 | template<>
 | 
|---|
 | 202 | class _bz_acos<complex<double> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 203 | public:
 | 
|---|
 | 204 |     typedef complex<double>  T_numtype1;
 | 
|---|
 | 205 |     typedef complex<double> T_numtype;
 | 
|---|
 | 206 | 
 | 
|---|
 | 207 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 208 |     { return BZ_CMATHFN_SCOPE(acos)((complex<double> )x); }
 | 
|---|
 | 209 | 
 | 
|---|
 | 210 |     template<class T1>
 | 
|---|
 | 211 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 212 |         const T1& a)
 | 
|---|
 | 213 |     {
 | 
|---|
 | 214 |         str += "acos(";
 | 
|---|
 | 215 |         a.prettyPrint(str,format);
 | 
|---|
 | 216 |         str += ")";
 | 
|---|
 | 217 |     }
 | 
|---|
 | 218 | };
 | 
|---|
 | 219 | #endif
 | 
|---|
 | 220 | 
 | 
|---|
 | 221 | // acos(complex<long double> )
 | 
|---|
 | 222 | #ifdef BZ_HAVE_COMPLEX_MATH2
 | 
|---|
 | 223 | template<>
 | 
|---|
 | 224 | class _bz_acos<complex<long double> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 225 | public:
 | 
|---|
 | 226 |     typedef complex<long double>  T_numtype1;
 | 
|---|
 | 227 |     typedef complex<long double> T_numtype;
 | 
|---|
 | 228 | 
 | 
|---|
 | 229 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 230 |     { return BZ_CMATHFN_SCOPE(acos)((complex<long double> )x); }
 | 
|---|
 | 231 | 
 | 
|---|
 | 232 |     template<class T1>
 | 
|---|
 | 233 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 234 |         const T1& a)
 | 
|---|
 | 235 |     {
 | 
|---|
 | 236 |         str += "acos(";
 | 
|---|
 | 237 |         a.prettyPrint(str,format);
 | 
|---|
 | 238 |         str += ")";
 | 
|---|
 | 239 |     }
 | 
|---|
 | 240 | };
 | 
|---|
 | 241 | #endif
 | 
|---|
 | 242 | 
 | 
|---|
 | 243 | // acosh(P_numtype1)    Inverse hyperbolic cosine
 | 
|---|
 | 244 | #ifdef BZ_HAVE_IEEE_MATH
 | 
|---|
 | 245 | template<class P_numtype1>
 | 
|---|
 | 246 | class _bz_acosh : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 247 | public:
 | 
|---|
 | 248 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 249 |     typedef double T_numtype;
 | 
|---|
 | 250 | 
 | 
|---|
 | 251 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 252 |     { return BZ_MATHFN_SCOPE(acosh)((double)x); }
 | 
|---|
 | 253 | 
 | 
|---|
 | 254 |     template<class T1>
 | 
|---|
 | 255 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 256 |         const T1& a)
 | 
|---|
 | 257 |     {
 | 
|---|
 | 258 |         str += "acosh(";
 | 
|---|
 | 259 |         a.prettyPrint(str,format);
 | 
|---|
 | 260 |         str += ")";
 | 
|---|
 | 261 |     }
 | 
|---|
 | 262 | };
 | 
|---|
 | 263 | #endif
 | 
|---|
 | 264 | 
 | 
|---|
 | 265 | // asin(P_numtype1)    Inverse sine
 | 
|---|
 | 266 | template<class P_numtype1>
 | 
|---|
 | 267 | class _bz_asin : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 268 | public:
 | 
|---|
 | 269 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 270 |     typedef double T_numtype;
 | 
|---|
 | 271 | 
 | 
|---|
 | 272 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 273 |     { return BZ_MATHFN_SCOPE(asin)((double)x); }
 | 
|---|
 | 274 | 
 | 
|---|
 | 275 |     template<class T1>
 | 
|---|
 | 276 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 277 |         const T1& a)
 | 
|---|
 | 278 |     {
 | 
|---|
 | 279 |         str += "asin(";
 | 
|---|
 | 280 |         a.prettyPrint(str,format);
 | 
|---|
 | 281 |         str += ")";
 | 
|---|
 | 282 |     }
 | 
|---|
 | 283 | };
 | 
|---|
 | 284 | 
 | 
|---|
 | 285 | // asin(float)
 | 
|---|
 | 286 | template<>
 | 
|---|
 | 287 | class _bz_asin<float> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 288 | public:
 | 
|---|
 | 289 |     typedef float T_numtype1;
 | 
|---|
 | 290 |     typedef float T_numtype;
 | 
|---|
 | 291 | 
 | 
|---|
 | 292 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 293 |     { return BZ_MATHFN_SCOPE(asin)((float)x); }
 | 
|---|
 | 294 | 
 | 
|---|
 | 295 |     template<class T1>
 | 
|---|
 | 296 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 297 |         const T1& a)
 | 
|---|
 | 298 |     {
 | 
|---|
 | 299 |         str += "asin(";
 | 
|---|
 | 300 |         a.prettyPrint(str,format);
 | 
|---|
 | 301 |         str += ")";
 | 
|---|
 | 302 |     }
 | 
|---|
 | 303 | };
 | 
|---|
 | 304 | 
 | 
|---|
 | 305 | // asin(long double)
 | 
|---|
 | 306 | template<>
 | 
|---|
 | 307 | class _bz_asin<long double> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 308 | public:
 | 
|---|
 | 309 |     typedef long double T_numtype1;
 | 
|---|
 | 310 |     typedef long double T_numtype;
 | 
|---|
 | 311 | 
 | 
|---|
 | 312 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 313 |     { return BZ_MATHFN_SCOPE(asin)((long double)x); }
 | 
|---|
 | 314 | 
 | 
|---|
 | 315 |     template<class T1>
 | 
|---|
 | 316 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 317 |         const T1& a)
 | 
|---|
 | 318 |     {
 | 
|---|
 | 319 |         str += "asin(";
 | 
|---|
 | 320 |         a.prettyPrint(str,format);
 | 
|---|
 | 321 |         str += ")";
 | 
|---|
 | 322 |     }
 | 
|---|
 | 323 | };
 | 
|---|
 | 324 | 
 | 
|---|
 | 325 | // asin(complex<float> )
 | 
|---|
 | 326 | #ifdef BZ_HAVE_COMPLEX_MATH2
 | 
|---|
 | 327 | template<>
 | 
|---|
 | 328 | class _bz_asin<complex<float> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 329 | public:
 | 
|---|
 | 330 |     typedef complex<float>  T_numtype1;
 | 
|---|
 | 331 |     typedef complex<float> T_numtype;
 | 
|---|
 | 332 | 
 | 
|---|
 | 333 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 334 |     { return BZ_CMATHFN_SCOPE(asin)((complex<float> )x); }
 | 
|---|
 | 335 | 
 | 
|---|
 | 336 |     template<class T1>
 | 
|---|
 | 337 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 338 |         const T1& a)
 | 
|---|
 | 339 |     {
 | 
|---|
 | 340 |         str += "asin(";
 | 
|---|
 | 341 |         a.prettyPrint(str,format);
 | 
|---|
 | 342 |         str += ")";
 | 
|---|
 | 343 |     }
 | 
|---|
 | 344 | };
 | 
|---|
 | 345 | #endif
 | 
|---|
 | 346 | 
 | 
|---|
 | 347 | // asin(complex<double> )
 | 
|---|
 | 348 | #ifdef BZ_HAVE_COMPLEX_MATH2
 | 
|---|
 | 349 | template<>
 | 
|---|
 | 350 | class _bz_asin<complex<double> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 351 | public:
 | 
|---|
 | 352 |     typedef complex<double>  T_numtype1;
 | 
|---|
 | 353 |     typedef complex<double> T_numtype;
 | 
|---|
 | 354 | 
 | 
|---|
 | 355 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 356 |     { return BZ_CMATHFN_SCOPE(asin)((complex<double> )x); }
 | 
|---|
 | 357 | 
 | 
|---|
 | 358 |     template<class T1>
 | 
|---|
 | 359 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 360 |         const T1& a)
 | 
|---|
 | 361 |     {
 | 
|---|
 | 362 |         str += "asin(";
 | 
|---|
 | 363 |         a.prettyPrint(str,format);
 | 
|---|
 | 364 |         str += ")";
 | 
|---|
 | 365 |     }
 | 
|---|
 | 366 | };
 | 
|---|
 | 367 | #endif
 | 
|---|
 | 368 | 
 | 
|---|
 | 369 | // asin(complex<long double> )
 | 
|---|
 | 370 | #ifdef BZ_HAVE_COMPLEX_MATH2
 | 
|---|
 | 371 | template<>
 | 
|---|
 | 372 | class _bz_asin<complex<long double> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 373 | public:
 | 
|---|
 | 374 |     typedef complex<long double>  T_numtype1;
 | 
|---|
 | 375 |     typedef complex<long double> T_numtype;
 | 
|---|
 | 376 | 
 | 
|---|
 | 377 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 378 |     { return BZ_CMATHFN_SCOPE(asin)((complex<long double> )x); }
 | 
|---|
 | 379 | 
 | 
|---|
 | 380 |     template<class T1>
 | 
|---|
 | 381 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 382 |         const T1& a)
 | 
|---|
 | 383 |     {
 | 
|---|
 | 384 |         str += "asin(";
 | 
|---|
 | 385 |         a.prettyPrint(str,format);
 | 
|---|
 | 386 |         str += ")";
 | 
|---|
 | 387 |     }
 | 
|---|
 | 388 | };
 | 
|---|
 | 389 | #endif
 | 
|---|
 | 390 | 
 | 
|---|
 | 391 | // asinh(P_numtype1)    Inverse hyperbolic sine
 | 
|---|
 | 392 | #ifdef BZ_HAVE_IEEE_MATH
 | 
|---|
 | 393 | template<class P_numtype1>
 | 
|---|
 | 394 | class _bz_asinh : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 395 | public:
 | 
|---|
 | 396 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 397 |     typedef double T_numtype;
 | 
|---|
 | 398 | 
 | 
|---|
 | 399 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 400 |     { return BZ_MATHFN_SCOPE(asinh)((double)x); }
 | 
|---|
 | 401 | 
 | 
|---|
 | 402 |     template<class T1>
 | 
|---|
 | 403 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 404 |         const T1& a)
 | 
|---|
 | 405 |     {
 | 
|---|
 | 406 |         str += "asinh(";
 | 
|---|
 | 407 |         a.prettyPrint(str,format);
 | 
|---|
 | 408 |         str += ")";
 | 
|---|
 | 409 |     }
 | 
|---|
 | 410 | };
 | 
|---|
 | 411 | #endif
 | 
|---|
 | 412 | 
 | 
|---|
 | 413 | // atan(P_numtype1)    Inverse tangent
 | 
|---|
 | 414 | template<class P_numtype1>
 | 
|---|
 | 415 | class _bz_atan : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 416 | public:
 | 
|---|
 | 417 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 418 |     typedef double T_numtype;
 | 
|---|
 | 419 | 
 | 
|---|
 | 420 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 421 |     { return BZ_MATHFN_SCOPE(atan)((double)x); }
 | 
|---|
 | 422 | 
 | 
|---|
 | 423 |     template<class T1>
 | 
|---|
 | 424 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 425 |         const T1& a)
 | 
|---|
 | 426 |     {
 | 
|---|
 | 427 |         str += "atan(";
 | 
|---|
 | 428 |         a.prettyPrint(str,format);
 | 
|---|
 | 429 |         str += ")";
 | 
|---|
 | 430 |     }
 | 
|---|
 | 431 | };
 | 
|---|
 | 432 | 
 | 
|---|
 | 433 | // atan(float)
 | 
|---|
 | 434 | template<>
 | 
|---|
 | 435 | class _bz_atan<float> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 436 | public:
 | 
|---|
 | 437 |     typedef float T_numtype1;
 | 
|---|
 | 438 |     typedef float T_numtype;
 | 
|---|
 | 439 | 
 | 
|---|
 | 440 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 441 |     { return BZ_MATHFN_SCOPE(atan)((float)x); }
 | 
|---|
 | 442 | 
 | 
|---|
 | 443 |     template<class T1>
 | 
|---|
 | 444 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 445 |         const T1& a)
 | 
|---|
 | 446 |     {
 | 
|---|
 | 447 |         str += "atan(";
 | 
|---|
 | 448 |         a.prettyPrint(str,format);
 | 
|---|
 | 449 |         str += ")";
 | 
|---|
 | 450 |     }
 | 
|---|
 | 451 | };
 | 
|---|
 | 452 | 
 | 
|---|
 | 453 | // atan(long double)
 | 
|---|
 | 454 | template<>
 | 
|---|
 | 455 | class _bz_atan<long double> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 456 | public:
 | 
|---|
 | 457 |     typedef long double T_numtype1;
 | 
|---|
 | 458 |     typedef long double T_numtype;
 | 
|---|
 | 459 | 
 | 
|---|
 | 460 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 461 |     { return BZ_MATHFN_SCOPE(atan)((long double)x); }
 | 
|---|
 | 462 | 
 | 
|---|
 | 463 |     template<class T1>
 | 
|---|
 | 464 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 465 |         const T1& a)
 | 
|---|
 | 466 |     {
 | 
|---|
 | 467 |         str += "atan(";
 | 
|---|
 | 468 |         a.prettyPrint(str,format);
 | 
|---|
 | 469 |         str += ")";
 | 
|---|
 | 470 |     }
 | 
|---|
 | 471 | };
 | 
|---|
 | 472 | 
 | 
|---|
 | 473 | // atan(complex<float> )
 | 
|---|
 | 474 | #ifdef BZ_HAVE_COMPLEX_MATH2
 | 
|---|
 | 475 | template<>
 | 
|---|
 | 476 | class _bz_atan<complex<float> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 477 | public:
 | 
|---|
 | 478 |     typedef complex<float>  T_numtype1;
 | 
|---|
 | 479 |     typedef complex<float> T_numtype;
 | 
|---|
 | 480 | 
 | 
|---|
 | 481 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 482 |     { return BZ_CMATHFN_SCOPE(atan)((complex<float> )x); }
 | 
|---|
 | 483 | 
 | 
|---|
 | 484 |     template<class T1>
 | 
|---|
 | 485 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 486 |         const T1& a)
 | 
|---|
 | 487 |     {
 | 
|---|
 | 488 |         str += "atan(";
 | 
|---|
 | 489 |         a.prettyPrint(str,format);
 | 
|---|
 | 490 |         str += ")";
 | 
|---|
 | 491 |     }
 | 
|---|
 | 492 | };
 | 
|---|
 | 493 | #endif
 | 
|---|
 | 494 | 
 | 
|---|
 | 495 | // atan(complex<double> )
 | 
|---|
 | 496 | #ifdef BZ_HAVE_COMPLEX_MATH2
 | 
|---|
 | 497 | template<>
 | 
|---|
 | 498 | class _bz_atan<complex<double> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 499 | public:
 | 
|---|
 | 500 |     typedef complex<double>  T_numtype1;
 | 
|---|
 | 501 |     typedef complex<double> T_numtype;
 | 
|---|
 | 502 | 
 | 
|---|
 | 503 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 504 |     { return BZ_CMATHFN_SCOPE(atan)((complex<double> )x); }
 | 
|---|
 | 505 | 
 | 
|---|
 | 506 |     template<class T1>
 | 
|---|
 | 507 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 508 |         const T1& a)
 | 
|---|
 | 509 |     {
 | 
|---|
 | 510 |         str += "atan(";
 | 
|---|
 | 511 |         a.prettyPrint(str,format);
 | 
|---|
 | 512 |         str += ")";
 | 
|---|
 | 513 |     }
 | 
|---|
 | 514 | };
 | 
|---|
 | 515 | #endif
 | 
|---|
 | 516 | 
 | 
|---|
 | 517 | // atan(complex<long double> )
 | 
|---|
 | 518 | #ifdef BZ_HAVE_COMPLEX_MATH2
 | 
|---|
 | 519 | template<>
 | 
|---|
 | 520 | class _bz_atan<complex<long double> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 521 | public:
 | 
|---|
 | 522 |     typedef complex<long double>  T_numtype1;
 | 
|---|
 | 523 |     typedef complex<long double> T_numtype;
 | 
|---|
 | 524 | 
 | 
|---|
 | 525 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 526 |     { return BZ_CMATHFN_SCOPE(atan)((complex<long double> )x); }
 | 
|---|
 | 527 | 
 | 
|---|
 | 528 |     template<class T1>
 | 
|---|
 | 529 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 530 |         const T1& a)
 | 
|---|
 | 531 |     {
 | 
|---|
 | 532 |         str += "atan(";
 | 
|---|
 | 533 |         a.prettyPrint(str,format);
 | 
|---|
 | 534 |         str += ")";
 | 
|---|
 | 535 |     }
 | 
|---|
 | 536 | };
 | 
|---|
 | 537 | #endif
 | 
|---|
 | 538 | 
 | 
|---|
 | 539 | // atanh(P_numtype1)    Inverse hyperbolic tangent
 | 
|---|
 | 540 | #ifdef BZ_HAVE_IEEE_MATH
 | 
|---|
 | 541 | template<class P_numtype1>
 | 
|---|
 | 542 | class _bz_atanh : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 543 | public:
 | 
|---|
 | 544 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 545 |     typedef double T_numtype;
 | 
|---|
 | 546 | 
 | 
|---|
 | 547 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 548 |     { return BZ_MATHFN_SCOPE(atanh)((double)x); }
 | 
|---|
 | 549 | 
 | 
|---|
 | 550 |     template<class T1>
 | 
|---|
 | 551 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 552 |         const T1& a)
 | 
|---|
 | 553 |     {
 | 
|---|
 | 554 |         str += "atanh(";
 | 
|---|
 | 555 |         a.prettyPrint(str,format);
 | 
|---|
 | 556 |         str += ")";
 | 
|---|
 | 557 |     }
 | 
|---|
 | 558 | };
 | 
|---|
 | 559 | #endif
 | 
|---|
 | 560 | 
 | 
|---|
 | 561 | // atan2(P_numtype1, P_numtype2)    Inverse tangent
 | 
|---|
 | 562 | template<class P_numtype1, class P_numtype2>
 | 
|---|
 | 563 | class _bz_atan2 : public TwoOperandApplicativeTemplatesBase {
 | 
|---|
 | 564 | public:
 | 
|---|
 | 565 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 566 |     typedef P_numtype2 T_numtype2;
 | 
|---|
 | 567 |     typedef double T_numtype;
 | 
|---|
 | 568 | 
 | 
|---|
 | 569 |     static inline T_numtype apply(T_numtype1 x, T_numtype2 y)
 | 
|---|
 | 570 |     { return BZ_MATHFN_SCOPE(atan2)((double)x,(double)y); }
 | 
|---|
 | 571 | };
 | 
|---|
 | 572 | 
 | 
|---|
 | 573 | // atan2(float, float)
 | 
|---|
 | 574 | template<>
 | 
|---|
 | 575 | class _bz_atan2<float, float > : public TwoOperandApplicativeTemplatesBase {
 | 
|---|
 | 576 | public:
 | 
|---|
 | 577 |     typedef float T_numtype1;
 | 
|---|
 | 578 |     typedef float T_numtype2;
 | 
|---|
 | 579 |     typedef float T_numtype;
 | 
|---|
 | 580 | 
 | 
|---|
 | 581 |     static inline T_numtype apply(T_numtype1 x, T_numtype2 y)
 | 
|---|
 | 582 |     { return BZ_MATHFN_SCOPE(atan2)((float)x,(float)y); }
 | 
|---|
 | 583 | };
 | 
|---|
 | 584 | 
 | 
|---|
 | 585 | // atan2(long double, long double)
 | 
|---|
 | 586 | template<>
 | 
|---|
 | 587 | class _bz_atan2<long double, long double > : public TwoOperandApplicativeTemplatesBase {
 | 
|---|
 | 588 | public:
 | 
|---|
 | 589 |     typedef long double T_numtype1;
 | 
|---|
 | 590 |     typedef long double T_numtype2;
 | 
|---|
 | 591 |     typedef long double T_numtype;
 | 
|---|
 | 592 | 
 | 
|---|
 | 593 |     static inline T_numtype apply(T_numtype1 x, T_numtype2 y)
 | 
|---|
 | 594 |     { return BZ_MATHFN_SCOPE(atan2)((long double)x,(long double)y); }
 | 
|---|
 | 595 | };
 | 
|---|
 | 596 | 
 | 
|---|
 | 597 | // _class(P_numtype1)    Classification of float-point value (FP_xxx)
 | 
|---|
 | 598 | #ifdef BZ_HAVE_SYSTEM_V_MATH
 | 
|---|
 | 599 | template<class P_numtype1>
 | 
|---|
 | 600 | class _bz__class : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 601 | public:
 | 
|---|
 | 602 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 603 |     typedef int T_numtype;
 | 
|---|
 | 604 | 
 | 
|---|
 | 605 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 606 |     { return BZ_MATHFN_SCOPE(_class)(x); }
 | 
|---|
 | 607 | 
 | 
|---|
 | 608 |     template<class T1>
 | 
|---|
 | 609 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 610 |         const T1& a)
 | 
|---|
 | 611 |     {
 | 
|---|
 | 612 |         str += "_class(";
 | 
|---|
 | 613 |         a.prettyPrint(str,format);
 | 
|---|
 | 614 |         str += ")";
 | 
|---|
 | 615 |     }
 | 
|---|
 | 616 | };
 | 
|---|
 | 617 | #endif
 | 
|---|
 | 618 | 
 | 
|---|
 | 619 | // cbrt(P_numtype1)    Cube root
 | 
|---|
 | 620 | #ifdef BZ_HAVE_IEEE_MATH
 | 
|---|
 | 621 | template<class P_numtype1>
 | 
|---|
 | 622 | class _bz_cbrt : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 623 | public:
 | 
|---|
 | 624 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 625 |     typedef double T_numtype;
 | 
|---|
 | 626 | 
 | 
|---|
 | 627 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 628 |     { return BZ_MATHFN_SCOPE(cbrt)((double)x); }
 | 
|---|
 | 629 | 
 | 
|---|
 | 630 |     template<class T1>
 | 
|---|
 | 631 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 632 |         const T1& a)
 | 
|---|
 | 633 |     {
 | 
|---|
 | 634 |         str += "cbrt(";
 | 
|---|
 | 635 |         a.prettyPrint(str,format);
 | 
|---|
 | 636 |         str += ")";
 | 
|---|
 | 637 |     }
 | 
|---|
 | 638 | };
 | 
|---|
 | 639 | #endif
 | 
|---|
 | 640 | 
 | 
|---|
 | 641 | // ceil(P_numtype1)    Ceiling
 | 
|---|
 | 642 | template<class P_numtype1>
 | 
|---|
 | 643 | class _bz_ceil : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 644 | public:
 | 
|---|
 | 645 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 646 |     typedef double T_numtype;
 | 
|---|
 | 647 | 
 | 
|---|
 | 648 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 649 |     { return BZ_MATHFN_SCOPE(ceil)((double)x); }
 | 
|---|
 | 650 | 
 | 
|---|
 | 651 |     template<class T1>
 | 
|---|
 | 652 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 653 |         const T1& a)
 | 
|---|
 | 654 |     {
 | 
|---|
 | 655 |         str += "ceil(";
 | 
|---|
 | 656 |         a.prettyPrint(str,format);
 | 
|---|
 | 657 |         str += ")";
 | 
|---|
 | 658 |     }
 | 
|---|
 | 659 | };
 | 
|---|
 | 660 | 
 | 
|---|
 | 661 | // ceil(float)
 | 
|---|
 | 662 | template<>
 | 
|---|
 | 663 | class _bz_ceil<float> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 664 | public:
 | 
|---|
 | 665 |     typedef float T_numtype1;
 | 
|---|
 | 666 |     typedef float T_numtype;
 | 
|---|
 | 667 | 
 | 
|---|
 | 668 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 669 |     { return BZ_MATHFN_SCOPE(ceil)((float)x); }
 | 
|---|
 | 670 | 
 | 
|---|
 | 671 |     template<class T1>
 | 
|---|
 | 672 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 673 |         const T1& a)
 | 
|---|
 | 674 |     {
 | 
|---|
 | 675 |         str += "ceil(";
 | 
|---|
 | 676 |         a.prettyPrint(str,format);
 | 
|---|
 | 677 |         str += ")";
 | 
|---|
 | 678 |     }
 | 
|---|
 | 679 | };
 | 
|---|
 | 680 | 
 | 
|---|
 | 681 | // ceil(long double)
 | 
|---|
 | 682 | template<>
 | 
|---|
 | 683 | class _bz_ceil<long double> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 684 | public:
 | 
|---|
 | 685 |     typedef long double T_numtype1;
 | 
|---|
 | 686 |     typedef long double T_numtype;
 | 
|---|
 | 687 | 
 | 
|---|
 | 688 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 689 |     { return BZ_MATHFN_SCOPE(ceil)((long double)x); }
 | 
|---|
 | 690 | 
 | 
|---|
 | 691 |     template<class T1>
 | 
|---|
 | 692 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 693 |         const T1& a)
 | 
|---|
 | 694 |     {
 | 
|---|
 | 695 |         str += "ceil(";
 | 
|---|
 | 696 |         a.prettyPrint(str,format);
 | 
|---|
 | 697 |         str += ")";
 | 
|---|
 | 698 |     }
 | 
|---|
 | 699 | };
 | 
|---|
 | 700 | 
 | 
|---|
 | 701 | // cos(P_numtype1)    Cosine
 | 
|---|
 | 702 | template<class P_numtype1>
 | 
|---|
 | 703 | class _bz_cos : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 704 | public:
 | 
|---|
 | 705 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 706 |     typedef double T_numtype;
 | 
|---|
 | 707 | 
 | 
|---|
 | 708 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 709 |     { return BZ_MATHFN_SCOPE(cos)((double)x); }
 | 
|---|
 | 710 | 
 | 
|---|
 | 711 |     template<class T1>
 | 
|---|
 | 712 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 713 |         const T1& a)
 | 
|---|
 | 714 |     {
 | 
|---|
 | 715 |         str += "cos(";
 | 
|---|
 | 716 |         a.prettyPrint(str,format);
 | 
|---|
 | 717 |         str += ")";
 | 
|---|
 | 718 |     }
 | 
|---|
 | 719 | };
 | 
|---|
 | 720 | 
 | 
|---|
 | 721 | // cos(float)
 | 
|---|
 | 722 | template<>
 | 
|---|
 | 723 | class _bz_cos<float> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 724 | public:
 | 
|---|
 | 725 |     typedef float T_numtype1;
 | 
|---|
 | 726 |     typedef float T_numtype;
 | 
|---|
 | 727 | 
 | 
|---|
 | 728 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 729 |     { return BZ_MATHFN_SCOPE(cos)((float)x); }
 | 
|---|
 | 730 | 
 | 
|---|
 | 731 |     template<class T1>
 | 
|---|
 | 732 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 733 |         const T1& a)
 | 
|---|
 | 734 |     {
 | 
|---|
 | 735 |         str += "cos(";
 | 
|---|
 | 736 |         a.prettyPrint(str,format);
 | 
|---|
 | 737 |         str += ")";
 | 
|---|
 | 738 |     }
 | 
|---|
 | 739 | };
 | 
|---|
 | 740 | 
 | 
|---|
 | 741 | // cos(long double)
 | 
|---|
 | 742 | template<>
 | 
|---|
 | 743 | class _bz_cos<long double> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 744 | public:
 | 
|---|
 | 745 |     typedef long double T_numtype1;
 | 
|---|
 | 746 |     typedef long double T_numtype;
 | 
|---|
 | 747 | 
 | 
|---|
 | 748 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 749 |     { return BZ_MATHFN_SCOPE(cos)((long double)x); }
 | 
|---|
 | 750 | 
 | 
|---|
 | 751 |     template<class T1>
 | 
|---|
 | 752 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 753 |         const T1& a)
 | 
|---|
 | 754 |     {
 | 
|---|
 | 755 |         str += "cos(";
 | 
|---|
 | 756 |         a.prettyPrint(str,format);
 | 
|---|
 | 757 |         str += ")";
 | 
|---|
 | 758 |     }
 | 
|---|
 | 759 | };
 | 
|---|
 | 760 | 
 | 
|---|
 | 761 | // cos(complex<float> )
 | 
|---|
 | 762 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 763 | template<>
 | 
|---|
 | 764 | class _bz_cos<complex<float> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 765 | public:
 | 
|---|
 | 766 |     typedef complex<float>  T_numtype1;
 | 
|---|
 | 767 |     typedef complex<float> T_numtype;
 | 
|---|
 | 768 | 
 | 
|---|
 | 769 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 770 |     { return BZ_CMATHFN_SCOPE(cos)((complex<float> )x); }
 | 
|---|
 | 771 | 
 | 
|---|
 | 772 |     template<class T1>
 | 
|---|
 | 773 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 774 |         const T1& a)
 | 
|---|
 | 775 |     {
 | 
|---|
 | 776 |         str += "cos(";
 | 
|---|
 | 777 |         a.prettyPrint(str,format);
 | 
|---|
 | 778 |         str += ")";
 | 
|---|
 | 779 |     }
 | 
|---|
 | 780 | };
 | 
|---|
 | 781 | #endif
 | 
|---|
 | 782 | 
 | 
|---|
 | 783 | // cos(complex<double> )
 | 
|---|
 | 784 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 785 | template<>
 | 
|---|
 | 786 | class _bz_cos<complex<double> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 787 | public:
 | 
|---|
 | 788 |     typedef complex<double>  T_numtype1;
 | 
|---|
 | 789 |     typedef complex<double> T_numtype;
 | 
|---|
 | 790 | 
 | 
|---|
 | 791 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 792 |     { return BZ_CMATHFN_SCOPE(cos)((complex<double> )x); }
 | 
|---|
 | 793 | 
 | 
|---|
 | 794 |     template<class T1>
 | 
|---|
 | 795 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 796 |         const T1& a)
 | 
|---|
 | 797 |     {
 | 
|---|
 | 798 |         str += "cos(";
 | 
|---|
 | 799 |         a.prettyPrint(str,format);
 | 
|---|
 | 800 |         str += ")";
 | 
|---|
 | 801 |     }
 | 
|---|
 | 802 | };
 | 
|---|
 | 803 | #endif
 | 
|---|
 | 804 | 
 | 
|---|
 | 805 | // cos(complex<long double> )
 | 
|---|
 | 806 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 807 | template<>
 | 
|---|
 | 808 | class _bz_cos<complex<long double> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 809 | public:
 | 
|---|
 | 810 |     typedef complex<long double>  T_numtype1;
 | 
|---|
 | 811 |     typedef complex<long double> T_numtype;
 | 
|---|
 | 812 | 
 | 
|---|
 | 813 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 814 |     { return BZ_CMATHFN_SCOPE(cos)((complex<long double> )x); }
 | 
|---|
 | 815 | 
 | 
|---|
 | 816 |     template<class T1>
 | 
|---|
 | 817 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 818 |         const T1& a)
 | 
|---|
 | 819 |     {
 | 
|---|
 | 820 |         str += "cos(";
 | 
|---|
 | 821 |         a.prettyPrint(str,format);
 | 
|---|
 | 822 |         str += ")";
 | 
|---|
 | 823 |     }
 | 
|---|
 | 824 | };
 | 
|---|
 | 825 | #endif
 | 
|---|
 | 826 | 
 | 
|---|
 | 827 | // copysign(P_numtype1, P_numtype2)
 | 
|---|
 | 828 | #ifdef BZ_HAVE_SYSTEM_V_MATH
 | 
|---|
 | 829 | template<class P_numtype1, class P_numtype2>
 | 
|---|
 | 830 | class _bz_copysign : public TwoOperandApplicativeTemplatesBase {
 | 
|---|
 | 831 | public:
 | 
|---|
 | 832 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 833 |     typedef P_numtype2 T_numtype2;
 | 
|---|
 | 834 |     typedef double T_numtype;
 | 
|---|
 | 835 | 
 | 
|---|
 | 836 |     static inline T_numtype apply(T_numtype1 x, T_numtype2 y)
 | 
|---|
 | 837 |     { return BZ_MATHFN_SCOPE(copysign)((double)x,(double)y); }
 | 
|---|
 | 838 | };
 | 
|---|
 | 839 | #endif
 | 
|---|
 | 840 | 
 | 
|---|
 | 841 | // cosh(P_numtype1)    Hyperbolic cosine
 | 
|---|
 | 842 | template<class P_numtype1>
 | 
|---|
 | 843 | class _bz_cosh : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 844 | public:
 | 
|---|
 | 845 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 846 |     typedef double T_numtype;
 | 
|---|
 | 847 | 
 | 
|---|
 | 848 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 849 |     { return BZ_MATHFN_SCOPE(cosh)((double)x); }
 | 
|---|
 | 850 | 
 | 
|---|
 | 851 |     template<class T1>
 | 
|---|
 | 852 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 853 |         const T1& a)
 | 
|---|
 | 854 |     {
 | 
|---|
 | 855 |         str += "cosh(";
 | 
|---|
 | 856 |         a.prettyPrint(str,format);
 | 
|---|
 | 857 |         str += ")";
 | 
|---|
 | 858 |     }
 | 
|---|
 | 859 | };
 | 
|---|
 | 860 | 
 | 
|---|
 | 861 | // cosh(float)
 | 
|---|
 | 862 | template<>
 | 
|---|
 | 863 | class _bz_cosh<float> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 864 | public:
 | 
|---|
 | 865 |     typedef float T_numtype1;
 | 
|---|
 | 866 |     typedef float T_numtype;
 | 
|---|
 | 867 | 
 | 
|---|
 | 868 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 869 |     { return BZ_MATHFN_SCOPE(cosh)((float)x); }
 | 
|---|
 | 870 | 
 | 
|---|
 | 871 |     template<class T1>
 | 
|---|
 | 872 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 873 |         const T1& a)
 | 
|---|
 | 874 |     {
 | 
|---|
 | 875 |         str += "cosh(";
 | 
|---|
 | 876 |         a.prettyPrint(str,format);
 | 
|---|
 | 877 |         str += ")";
 | 
|---|
 | 878 |     }
 | 
|---|
 | 879 | };
 | 
|---|
 | 880 | 
 | 
|---|
 | 881 | // cosh(long double)
 | 
|---|
 | 882 | template<>
 | 
|---|
 | 883 | class _bz_cosh<long double> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 884 | public:
 | 
|---|
 | 885 |     typedef long double T_numtype1;
 | 
|---|
 | 886 |     typedef long double T_numtype;
 | 
|---|
 | 887 | 
 | 
|---|
 | 888 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 889 |     { return BZ_MATHFN_SCOPE(cosh)((long double)x); }
 | 
|---|
 | 890 | 
 | 
|---|
 | 891 |     template<class T1>
 | 
|---|
 | 892 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 893 |         const T1& a)
 | 
|---|
 | 894 |     {
 | 
|---|
 | 895 |         str += "cosh(";
 | 
|---|
 | 896 |         a.prettyPrint(str,format);
 | 
|---|
 | 897 |         str += ")";
 | 
|---|
 | 898 |     }
 | 
|---|
 | 899 | };
 | 
|---|
 | 900 | 
 | 
|---|
 | 901 | // cosh(complex<float> )
 | 
|---|
 | 902 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 903 | template<>
 | 
|---|
 | 904 | class _bz_cosh<complex<float> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 905 | public:
 | 
|---|
 | 906 |     typedef complex<float>  T_numtype1;
 | 
|---|
 | 907 |     typedef complex<float> T_numtype;
 | 
|---|
 | 908 | 
 | 
|---|
 | 909 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 910 |     { return BZ_CMATHFN_SCOPE(cosh)((complex<float> )x); }
 | 
|---|
 | 911 | 
 | 
|---|
 | 912 |     template<class T1>
 | 
|---|
 | 913 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 914 |         const T1& a)
 | 
|---|
 | 915 |     {
 | 
|---|
 | 916 |         str += "cosh(";
 | 
|---|
 | 917 |         a.prettyPrint(str,format);
 | 
|---|
 | 918 |         str += ")";
 | 
|---|
 | 919 |     }
 | 
|---|
 | 920 | };
 | 
|---|
 | 921 | #endif
 | 
|---|
 | 922 | 
 | 
|---|
 | 923 | // cosh(complex<double> )
 | 
|---|
 | 924 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 925 | template<>
 | 
|---|
 | 926 | class _bz_cosh<complex<double> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 927 | public:
 | 
|---|
 | 928 |     typedef complex<double>  T_numtype1;
 | 
|---|
 | 929 |     typedef complex<double> T_numtype;
 | 
|---|
 | 930 | 
 | 
|---|
 | 931 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 932 |     { return BZ_CMATHFN_SCOPE(cosh)((complex<double> )x); }
 | 
|---|
 | 933 | 
 | 
|---|
 | 934 |     template<class T1>
 | 
|---|
 | 935 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 936 |         const T1& a)
 | 
|---|
 | 937 |     {
 | 
|---|
 | 938 |         str += "cosh(";
 | 
|---|
 | 939 |         a.prettyPrint(str,format);
 | 
|---|
 | 940 |         str += ")";
 | 
|---|
 | 941 |     }
 | 
|---|
 | 942 | };
 | 
|---|
 | 943 | #endif
 | 
|---|
 | 944 | 
 | 
|---|
 | 945 | // cosh(complex<long double> )
 | 
|---|
 | 946 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 947 | template<>
 | 
|---|
 | 948 | class _bz_cosh<complex<long double> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 949 | public:
 | 
|---|
 | 950 |     typedef complex<long double>  T_numtype1;
 | 
|---|
 | 951 |     typedef complex<long double> T_numtype;
 | 
|---|
 | 952 | 
 | 
|---|
 | 953 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 954 |     { return BZ_CMATHFN_SCOPE(cosh)((complex<long double> )x); }
 | 
|---|
 | 955 | 
 | 
|---|
 | 956 |     template<class T1>
 | 
|---|
 | 957 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 958 |         const T1& a)
 | 
|---|
 | 959 |     {
 | 
|---|
 | 960 |         str += "cosh(";
 | 
|---|
 | 961 |         a.prettyPrint(str,format);
 | 
|---|
 | 962 |         str += ")";
 | 
|---|
 | 963 |     }
 | 
|---|
 | 964 | };
 | 
|---|
 | 965 | #endif
 | 
|---|
 | 966 | 
 | 
|---|
 | 967 | // drem(P_numtype1, P_numtype2)    Remainder
 | 
|---|
 | 968 | #ifdef BZ_HAVE_SYSTEM_V_MATH
 | 
|---|
 | 969 | template<class P_numtype1, class P_numtype2>
 | 
|---|
 | 970 | class _bz_drem : public TwoOperandApplicativeTemplatesBase {
 | 
|---|
 | 971 | public:
 | 
|---|
 | 972 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 973 |     typedef P_numtype2 T_numtype2;
 | 
|---|
 | 974 |     typedef double T_numtype;
 | 
|---|
 | 975 | 
 | 
|---|
 | 976 |     static inline T_numtype apply(T_numtype1 x, T_numtype2 y)
 | 
|---|
 | 977 |     { return BZ_MATHFN_SCOPE(drem)((double)x,(double)y); }
 | 
|---|
 | 978 | };
 | 
|---|
 | 979 | #endif
 | 
|---|
 | 980 | 
 | 
|---|
 | 981 | // exp(P_numtype1)    Exponential
 | 
|---|
 | 982 | template<class P_numtype1>
 | 
|---|
 | 983 | class _bz_exp : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 984 | public:
 | 
|---|
 | 985 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 986 |     typedef double T_numtype;
 | 
|---|
 | 987 | 
 | 
|---|
 | 988 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 989 |     { return BZ_MATHFN_SCOPE(exp)((double)x); }
 | 
|---|
 | 990 | 
 | 
|---|
 | 991 |     template<class T1>
 | 
|---|
 | 992 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 993 |         const T1& a)
 | 
|---|
 | 994 |     {
 | 
|---|
 | 995 |         str += "exp(";
 | 
|---|
 | 996 |         a.prettyPrint(str,format);
 | 
|---|
 | 997 |         str += ")";
 | 
|---|
 | 998 |     }
 | 
|---|
 | 999 | };
 | 
|---|
 | 1000 | 
 | 
|---|
 | 1001 | // exp(float)
 | 
|---|
 | 1002 | template<>
 | 
|---|
 | 1003 | class _bz_exp<float> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1004 | public:
 | 
|---|
 | 1005 |     typedef float T_numtype1;
 | 
|---|
 | 1006 |     typedef float T_numtype;
 | 
|---|
 | 1007 | 
 | 
|---|
 | 1008 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1009 |     { return BZ_MATHFN_SCOPE(exp)((float)x); }
 | 
|---|
 | 1010 | 
 | 
|---|
 | 1011 |     template<class T1>
 | 
|---|
 | 1012 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1013 |         const T1& a)
 | 
|---|
 | 1014 |     {
 | 
|---|
 | 1015 |         str += "exp(";
 | 
|---|
 | 1016 |         a.prettyPrint(str,format);
 | 
|---|
 | 1017 |         str += ")";
 | 
|---|
 | 1018 |     }
 | 
|---|
 | 1019 | };
 | 
|---|
 | 1020 | 
 | 
|---|
 | 1021 | // exp(long double)
 | 
|---|
 | 1022 | template<>
 | 
|---|
 | 1023 | class _bz_exp<long double> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1024 | public:
 | 
|---|
 | 1025 |     typedef long double T_numtype1;
 | 
|---|
 | 1026 |     typedef long double T_numtype;
 | 
|---|
 | 1027 | 
 | 
|---|
 | 1028 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1029 |     { return BZ_MATHFN_SCOPE(exp)((long double)x); }
 | 
|---|
 | 1030 | 
 | 
|---|
 | 1031 |     template<class T1>
 | 
|---|
 | 1032 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1033 |         const T1& a)
 | 
|---|
 | 1034 |     {
 | 
|---|
 | 1035 |         str += "exp(";
 | 
|---|
 | 1036 |         a.prettyPrint(str,format);
 | 
|---|
 | 1037 |         str += ")";
 | 
|---|
 | 1038 |     }
 | 
|---|
 | 1039 | };
 | 
|---|
 | 1040 | 
 | 
|---|
 | 1041 | // exp(complex<float> )
 | 
|---|
 | 1042 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 1043 | template<>
 | 
|---|
 | 1044 | class _bz_exp<complex<float> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1045 | public:
 | 
|---|
 | 1046 |     typedef complex<float>  T_numtype1;
 | 
|---|
 | 1047 |     typedef complex<float> T_numtype;
 | 
|---|
 | 1048 | 
 | 
|---|
 | 1049 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1050 |     { return BZ_CMATHFN_SCOPE(exp)((complex<float> )x); }
 | 
|---|
 | 1051 | 
 | 
|---|
 | 1052 |     template<class T1>
 | 
|---|
 | 1053 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1054 |         const T1& a)
 | 
|---|
 | 1055 |     {
 | 
|---|
 | 1056 |         str += "exp(";
 | 
|---|
 | 1057 |         a.prettyPrint(str,format);
 | 
|---|
 | 1058 |         str += ")";
 | 
|---|
 | 1059 |     }
 | 
|---|
 | 1060 | };
 | 
|---|
 | 1061 | #endif
 | 
|---|
 | 1062 | 
 | 
|---|
 | 1063 | // exp(complex<double> )
 | 
|---|
 | 1064 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 1065 | template<>
 | 
|---|
 | 1066 | class _bz_exp<complex<double> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1067 | public:
 | 
|---|
 | 1068 |     typedef complex<double>  T_numtype1;
 | 
|---|
 | 1069 |     typedef complex<double> T_numtype;
 | 
|---|
 | 1070 | 
 | 
|---|
 | 1071 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1072 |     { return BZ_CMATHFN_SCOPE(exp)((complex<double> )x); }
 | 
|---|
 | 1073 | 
 | 
|---|
 | 1074 |     template<class T1>
 | 
|---|
 | 1075 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1076 |         const T1& a)
 | 
|---|
 | 1077 |     {
 | 
|---|
 | 1078 |         str += "exp(";
 | 
|---|
 | 1079 |         a.prettyPrint(str,format);
 | 
|---|
 | 1080 |         str += ")";
 | 
|---|
 | 1081 |     }
 | 
|---|
 | 1082 | };
 | 
|---|
 | 1083 | #endif
 | 
|---|
 | 1084 | 
 | 
|---|
 | 1085 | // exp(complex<long double> )
 | 
|---|
 | 1086 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 1087 | template<>
 | 
|---|
 | 1088 | class _bz_exp<complex<long double> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1089 | public:
 | 
|---|
 | 1090 |     typedef complex<long double>  T_numtype1;
 | 
|---|
 | 1091 |     typedef complex<long double> T_numtype;
 | 
|---|
 | 1092 | 
 | 
|---|
 | 1093 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1094 |     { return BZ_CMATHFN_SCOPE(exp)((complex<long double> )x); }
 | 
|---|
 | 1095 | 
 | 
|---|
 | 1096 |     template<class T1>
 | 
|---|
 | 1097 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1098 |         const T1& a)
 | 
|---|
 | 1099 |     {
 | 
|---|
 | 1100 |         str += "exp(";
 | 
|---|
 | 1101 |         a.prettyPrint(str,format);
 | 
|---|
 | 1102 |         str += ")";
 | 
|---|
 | 1103 |     }
 | 
|---|
 | 1104 | };
 | 
|---|
 | 1105 | #endif
 | 
|---|
 | 1106 | 
 | 
|---|
 | 1107 | // expm1(P_numtype1)    Exp(x)-1
 | 
|---|
 | 1108 | #ifdef BZ_HAVE_IEEE_MATH
 | 
|---|
 | 1109 | template<class P_numtype1>
 | 
|---|
 | 1110 | class _bz_expm1 : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1111 | public:
 | 
|---|
 | 1112 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 1113 |     typedef double T_numtype;
 | 
|---|
 | 1114 | 
 | 
|---|
 | 1115 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1116 |     { return BZ_MATHFN_SCOPE(expm1)((double)x); }
 | 
|---|
 | 1117 | 
 | 
|---|
 | 1118 |     template<class T1>
 | 
|---|
 | 1119 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1120 |         const T1& a)
 | 
|---|
 | 1121 |     {
 | 
|---|
 | 1122 |         str += "expm1(";
 | 
|---|
 | 1123 |         a.prettyPrint(str,format);
 | 
|---|
 | 1124 |         str += ")";
 | 
|---|
 | 1125 |     }
 | 
|---|
 | 1126 | };
 | 
|---|
 | 1127 | #endif
 | 
|---|
 | 1128 | 
 | 
|---|
 | 1129 | // erf(P_numtype1)    Error function
 | 
|---|
 | 1130 | #ifdef BZ_HAVE_IEEE_MATH
 | 
|---|
 | 1131 | template<class P_numtype1>
 | 
|---|
 | 1132 | class _bz_erf : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1133 | public:
 | 
|---|
 | 1134 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 1135 |     typedef double T_numtype;
 | 
|---|
 | 1136 | 
 | 
|---|
 | 1137 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1138 |     { return BZ_MATHFN_SCOPE(erf)((double)x); }
 | 
|---|
 | 1139 | 
 | 
|---|
 | 1140 |     template<class T1>
 | 
|---|
 | 1141 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1142 |         const T1& a)
 | 
|---|
 | 1143 |     {
 | 
|---|
 | 1144 |         str += "erf(";
 | 
|---|
 | 1145 |         a.prettyPrint(str,format);
 | 
|---|
 | 1146 |         str += ")";
 | 
|---|
 | 1147 |     }
 | 
|---|
 | 1148 | };
 | 
|---|
 | 1149 | #endif
 | 
|---|
 | 1150 | 
 | 
|---|
 | 1151 | // erfc(P_numtype1)    Complementary error function
 | 
|---|
 | 1152 | #ifdef BZ_HAVE_IEEE_MATH
 | 
|---|
 | 1153 | template<class P_numtype1>
 | 
|---|
 | 1154 | class _bz_erfc : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1155 | public:
 | 
|---|
 | 1156 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 1157 |     typedef double T_numtype;
 | 
|---|
 | 1158 | 
 | 
|---|
 | 1159 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1160 |     { return BZ_MATHFN_SCOPE(erfc)((double)x); }
 | 
|---|
 | 1161 | 
 | 
|---|
 | 1162 |     template<class T1>
 | 
|---|
 | 1163 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1164 |         const T1& a)
 | 
|---|
 | 1165 |     {
 | 
|---|
 | 1166 |         str += "erfc(";
 | 
|---|
 | 1167 |         a.prettyPrint(str,format);
 | 
|---|
 | 1168 |         str += ")";
 | 
|---|
 | 1169 |     }
 | 
|---|
 | 1170 | };
 | 
|---|
 | 1171 | #endif
 | 
|---|
 | 1172 | 
 | 
|---|
 | 1173 | // finite(P_numtype1)    Nonzero if finite
 | 
|---|
 | 1174 | #ifdef BZ_HAVE_IEEE_MATH
 | 
|---|
 | 1175 | template<class P_numtype1>
 | 
|---|
 | 1176 | class _bz_finite : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1177 | public:
 | 
|---|
 | 1178 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 1179 |     typedef int T_numtype;
 | 
|---|
 | 1180 | 
 | 
|---|
 | 1181 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1182 |     { return BZ_MATHFN_SCOPE(finite)(x); }
 | 
|---|
 | 1183 | 
 | 
|---|
 | 1184 |     template<class T1>
 | 
|---|
 | 1185 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1186 |         const T1& a)
 | 
|---|
 | 1187 |     {
 | 
|---|
 | 1188 |         str += "finite(";
 | 
|---|
 | 1189 |         a.prettyPrint(str,format);
 | 
|---|
 | 1190 |         str += ")";
 | 
|---|
 | 1191 |     }
 | 
|---|
 | 1192 | };
 | 
|---|
 | 1193 | #endif
 | 
|---|
 | 1194 | 
 | 
|---|
 | 1195 | // floor(P_numtype1)    Floor function
 | 
|---|
 | 1196 | template<class P_numtype1>
 | 
|---|
 | 1197 | class _bz_floor : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1198 | public:
 | 
|---|
 | 1199 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 1200 |     typedef double T_numtype;
 | 
|---|
 | 1201 | 
 | 
|---|
 | 1202 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1203 |     { return BZ_MATHFN_SCOPE(floor)((double)x); }
 | 
|---|
 | 1204 | 
 | 
|---|
 | 1205 |     template<class T1>
 | 
|---|
 | 1206 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1207 |         const T1& a)
 | 
|---|
 | 1208 |     {
 | 
|---|
 | 1209 |         str += "floor(";
 | 
|---|
 | 1210 |         a.prettyPrint(str,format);
 | 
|---|
 | 1211 |         str += ")";
 | 
|---|
 | 1212 |     }
 | 
|---|
 | 1213 | };
 | 
|---|
 | 1214 | 
 | 
|---|
 | 1215 | // floor(float)
 | 
|---|
 | 1216 | template<>
 | 
|---|
 | 1217 | class _bz_floor<float> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1218 | public:
 | 
|---|
 | 1219 |     typedef float T_numtype1;
 | 
|---|
 | 1220 |     typedef float T_numtype;
 | 
|---|
 | 1221 | 
 | 
|---|
 | 1222 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1223 |     { return BZ_MATHFN_SCOPE(floor)((float)x); }
 | 
|---|
 | 1224 | 
 | 
|---|
 | 1225 |     template<class T1>
 | 
|---|
 | 1226 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1227 |         const T1& a)
 | 
|---|
 | 1228 |     {
 | 
|---|
 | 1229 |         str += "floor(";
 | 
|---|
 | 1230 |         a.prettyPrint(str,format);
 | 
|---|
 | 1231 |         str += ")";
 | 
|---|
 | 1232 |     }
 | 
|---|
 | 1233 | };
 | 
|---|
 | 1234 | 
 | 
|---|
 | 1235 | // floor(long double)
 | 
|---|
 | 1236 | template<>
 | 
|---|
 | 1237 | class _bz_floor<long double> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1238 | public:
 | 
|---|
 | 1239 |     typedef long double T_numtype1;
 | 
|---|
 | 1240 |     typedef long double T_numtype;
 | 
|---|
 | 1241 | 
 | 
|---|
 | 1242 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1243 |     { return BZ_MATHFN_SCOPE(floor)((long double)x); }
 | 
|---|
 | 1244 | 
 | 
|---|
 | 1245 |     template<class T1>
 | 
|---|
 | 1246 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1247 |         const T1& a)
 | 
|---|
 | 1248 |     {
 | 
|---|
 | 1249 |         str += "floor(";
 | 
|---|
 | 1250 |         a.prettyPrint(str,format);
 | 
|---|
 | 1251 |         str += ")";
 | 
|---|
 | 1252 |     }
 | 
|---|
 | 1253 | };
 | 
|---|
 | 1254 | 
 | 
|---|
 | 1255 | // fmod(P_numtype1, P_numtype2)    Modulo remainder
 | 
|---|
 | 1256 | #ifdef BZ_HAVE_SYSTEM_V_MATH
 | 
|---|
 | 1257 | template<class P_numtype1, class P_numtype2>
 | 
|---|
 | 1258 | class _bz_fmod : public TwoOperandApplicativeTemplatesBase {
 | 
|---|
 | 1259 | public:
 | 
|---|
 | 1260 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 1261 |     typedef P_numtype2 T_numtype2;
 | 
|---|
 | 1262 |     typedef double T_numtype;
 | 
|---|
 | 1263 | 
 | 
|---|
 | 1264 |     static inline T_numtype apply(T_numtype1 x, T_numtype2 y)
 | 
|---|
 | 1265 |     { return BZ_MATHFN_SCOPE(fmod)((double)x,(double)y); }
 | 
|---|
 | 1266 | };
 | 
|---|
 | 1267 | #endif
 | 
|---|
 | 1268 | 
 | 
|---|
 | 1269 | // hypot(P_numtype1, P_numtype2)    sqrt(x*x+y*y)
 | 
|---|
 | 1270 | #ifdef BZ_HAVE_SYSTEM_V_MATH
 | 
|---|
 | 1271 | template<class P_numtype1, class P_numtype2>
 | 
|---|
 | 1272 | class _bz_hypot : public TwoOperandApplicativeTemplatesBase {
 | 
|---|
 | 1273 | public:
 | 
|---|
 | 1274 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 1275 |     typedef P_numtype2 T_numtype2;
 | 
|---|
 | 1276 |     typedef double T_numtype;
 | 
|---|
 | 1277 | 
 | 
|---|
 | 1278 |     static inline T_numtype apply(T_numtype1 x, T_numtype2 y)
 | 
|---|
 | 1279 |     { return BZ_MATHFN_SCOPE(hypot)((double)x,(double)y); }
 | 
|---|
 | 1280 | };
 | 
|---|
 | 1281 | #endif
 | 
|---|
 | 1282 | 
 | 
|---|
 | 1283 | // ilogb(P_numtype1)    Integer unbiased exponent
 | 
|---|
 | 1284 | #ifdef BZ_HAVE_SYSTEM_V_MATH
 | 
|---|
 | 1285 | template<class P_numtype1>
 | 
|---|
 | 1286 | class _bz_ilogb : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1287 | public:
 | 
|---|
 | 1288 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 1289 |     typedef int T_numtype;
 | 
|---|
 | 1290 | 
 | 
|---|
 | 1291 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1292 |     { return BZ_MATHFN_SCOPE(ilogb)(x); }
 | 
|---|
 | 1293 | 
 | 
|---|
 | 1294 |     template<class T1>
 | 
|---|
 | 1295 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1296 |         const T1& a)
 | 
|---|
 | 1297 |     {
 | 
|---|
 | 1298 |         str += "ilogb(";
 | 
|---|
 | 1299 |         a.prettyPrint(str,format);
 | 
|---|
 | 1300 |         str += ")";
 | 
|---|
 | 1301 |     }
 | 
|---|
 | 1302 | };
 | 
|---|
 | 1303 | #endif
 | 
|---|
 | 1304 | 
 | 
|---|
 | 1305 | // isnan(P_numtype1)    Nonzero if NaNS or NaNQ
 | 
|---|
 | 1306 | #ifdef BZ_HAVE_IEEE_MATH
 | 
|---|
 | 1307 | template<class P_numtype1>
 | 
|---|
 | 1308 | class _bz_isnan : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1309 | public:
 | 
|---|
 | 1310 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 1311 |     typedef int T_numtype;
 | 
|---|
 | 1312 | 
 | 
|---|
 | 1313 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1314 |     { return BZ_MATHFN_SCOPE(isnan)(x); }
 | 
|---|
 | 1315 | 
 | 
|---|
 | 1316 |     template<class T1>
 | 
|---|
 | 1317 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1318 |         const T1& a)
 | 
|---|
 | 1319 |     {
 | 
|---|
 | 1320 |         str += "isnan(";
 | 
|---|
 | 1321 |         a.prettyPrint(str,format);
 | 
|---|
 | 1322 |         str += ")";
 | 
|---|
 | 1323 |     }
 | 
|---|
 | 1324 | };
 | 
|---|
 | 1325 | #endif
 | 
|---|
 | 1326 | 
 | 
|---|
 | 1327 | // itrunc(P_numtype1)    Truncate and convert to integer
 | 
|---|
 | 1328 | #ifdef BZ_HAVE_SYSTEM_V_MATH
 | 
|---|
 | 1329 | template<class P_numtype1>
 | 
|---|
 | 1330 | class _bz_itrunc : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1331 | public:
 | 
|---|
 | 1332 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 1333 |     typedef int T_numtype;
 | 
|---|
 | 1334 | 
 | 
|---|
 | 1335 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1336 |     { return BZ_MATHFN_SCOPE(itrunc)(x); }
 | 
|---|
 | 1337 | 
 | 
|---|
 | 1338 |     template<class T1>
 | 
|---|
 | 1339 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1340 |         const T1& a)
 | 
|---|
 | 1341 |     {
 | 
|---|
 | 1342 |         str += "itrunc(";
 | 
|---|
 | 1343 |         a.prettyPrint(str,format);
 | 
|---|
 | 1344 |         str += ")";
 | 
|---|
 | 1345 |     }
 | 
|---|
 | 1346 | };
 | 
|---|
 | 1347 | #endif
 | 
|---|
 | 1348 | 
 | 
|---|
 | 1349 | // j0(P_numtype1)    Bessel function first kind, order 0
 | 
|---|
 | 1350 | #ifdef BZ_HAVE_IEEE_MATH
 | 
|---|
 | 1351 | template<class P_numtype1>
 | 
|---|
 | 1352 | class _bz_j0 : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1353 | public:
 | 
|---|
 | 1354 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 1355 |     typedef double T_numtype;
 | 
|---|
 | 1356 | 
 | 
|---|
 | 1357 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1358 |     { return BZ_MATHFN_SCOPE(j0)((double)x); }
 | 
|---|
 | 1359 | 
 | 
|---|
 | 1360 |     template<class T1>
 | 
|---|
 | 1361 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1362 |         const T1& a)
 | 
|---|
 | 1363 |     {
 | 
|---|
 | 1364 |         str += "j0(";
 | 
|---|
 | 1365 |         a.prettyPrint(str,format);
 | 
|---|
 | 1366 |         str += ")";
 | 
|---|
 | 1367 |     }
 | 
|---|
 | 1368 | };
 | 
|---|
 | 1369 | #endif
 | 
|---|
 | 1370 | 
 | 
|---|
 | 1371 | // j1(P_numtype1)    Bessel function first kind, order 1
 | 
|---|
 | 1372 | #ifdef BZ_HAVE_IEEE_MATH
 | 
|---|
 | 1373 | template<class P_numtype1>
 | 
|---|
 | 1374 | class _bz_j1 : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1375 | public:
 | 
|---|
 | 1376 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 1377 |     typedef double T_numtype;
 | 
|---|
 | 1378 | 
 | 
|---|
 | 1379 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1380 |     { return BZ_MATHFN_SCOPE(j1)((double)x); }
 | 
|---|
 | 1381 | 
 | 
|---|
 | 1382 |     template<class T1>
 | 
|---|
 | 1383 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1384 |         const T1& a)
 | 
|---|
 | 1385 |     {
 | 
|---|
 | 1386 |         str += "j1(";
 | 
|---|
 | 1387 |         a.prettyPrint(str,format);
 | 
|---|
 | 1388 |         str += ")";
 | 
|---|
 | 1389 |     }
 | 
|---|
 | 1390 | };
 | 
|---|
 | 1391 | #endif
 | 
|---|
 | 1392 | 
 | 
|---|
 | 1393 | // lgamma(P_numtype1)    Log absolute gamma
 | 
|---|
 | 1394 | #ifdef BZ_HAVE_IEEE_MATH
 | 
|---|
 | 1395 | template<class P_numtype1>
 | 
|---|
 | 1396 | class _bz_lgamma : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1397 | public:
 | 
|---|
 | 1398 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 1399 |     typedef double T_numtype;
 | 
|---|
 | 1400 | 
 | 
|---|
 | 1401 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1402 |     { return BZ_MATHFN_SCOPE(lgamma)((double)x); }
 | 
|---|
 | 1403 | 
 | 
|---|
 | 1404 |     template<class T1>
 | 
|---|
 | 1405 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1406 |         const T1& a)
 | 
|---|
 | 1407 |     {
 | 
|---|
 | 1408 |         str += "lgamma(";
 | 
|---|
 | 1409 |         a.prettyPrint(str,format);
 | 
|---|
 | 1410 |         str += ")";
 | 
|---|
 | 1411 |     }
 | 
|---|
 | 1412 | };
 | 
|---|
 | 1413 | #endif
 | 
|---|
 | 1414 | 
 | 
|---|
 | 1415 | // log(P_numtype1)    Natural logarithm
 | 
|---|
 | 1416 | template<class P_numtype1>
 | 
|---|
 | 1417 | class _bz_log : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1418 | public:
 | 
|---|
 | 1419 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 1420 |     typedef double T_numtype;
 | 
|---|
 | 1421 | 
 | 
|---|
 | 1422 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1423 |     { return BZ_MATHFN_SCOPE(log)((double)x); }
 | 
|---|
 | 1424 | 
 | 
|---|
 | 1425 |     template<class T1>
 | 
|---|
 | 1426 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1427 |         const T1& a)
 | 
|---|
 | 1428 |     {
 | 
|---|
 | 1429 |         str += "log(";
 | 
|---|
 | 1430 |         a.prettyPrint(str,format);
 | 
|---|
 | 1431 |         str += ")";
 | 
|---|
 | 1432 |     }
 | 
|---|
 | 1433 | };
 | 
|---|
 | 1434 | 
 | 
|---|
 | 1435 | // log(float)
 | 
|---|
 | 1436 | template<>
 | 
|---|
 | 1437 | class _bz_log<float> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1438 | public:
 | 
|---|
 | 1439 |     typedef float T_numtype1;
 | 
|---|
 | 1440 |     typedef float T_numtype;
 | 
|---|
 | 1441 | 
 | 
|---|
 | 1442 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1443 |     { return BZ_MATHFN_SCOPE(log)((float)x); }
 | 
|---|
 | 1444 | 
 | 
|---|
 | 1445 |     template<class T1>
 | 
|---|
 | 1446 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1447 |         const T1& a)
 | 
|---|
 | 1448 |     {
 | 
|---|
 | 1449 |         str += "log(";
 | 
|---|
 | 1450 |         a.prettyPrint(str,format);
 | 
|---|
 | 1451 |         str += ")";
 | 
|---|
 | 1452 |     }
 | 
|---|
 | 1453 | };
 | 
|---|
 | 1454 | 
 | 
|---|
 | 1455 | // log(long double)
 | 
|---|
 | 1456 | template<>
 | 
|---|
 | 1457 | class _bz_log<long double> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1458 | public:
 | 
|---|
 | 1459 |     typedef long double T_numtype1;
 | 
|---|
 | 1460 |     typedef long double T_numtype;
 | 
|---|
 | 1461 | 
 | 
|---|
 | 1462 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1463 |     { return BZ_MATHFN_SCOPE(log)((long double)x); }
 | 
|---|
 | 1464 | 
 | 
|---|
 | 1465 |     template<class T1>
 | 
|---|
 | 1466 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1467 |         const T1& a)
 | 
|---|
 | 1468 |     {
 | 
|---|
 | 1469 |         str += "log(";
 | 
|---|
 | 1470 |         a.prettyPrint(str,format);
 | 
|---|
 | 1471 |         str += ")";
 | 
|---|
 | 1472 |     }
 | 
|---|
 | 1473 | };
 | 
|---|
 | 1474 | 
 | 
|---|
 | 1475 | // log(complex<float> )
 | 
|---|
 | 1476 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 1477 | template<>
 | 
|---|
 | 1478 | class _bz_log<complex<float> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1479 | public:
 | 
|---|
 | 1480 |     typedef complex<float>  T_numtype1;
 | 
|---|
 | 1481 |     typedef complex<float> T_numtype;
 | 
|---|
 | 1482 | 
 | 
|---|
 | 1483 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1484 |     { return BZ_CMATHFN_SCOPE(log)((complex<float> )x); }
 | 
|---|
 | 1485 | 
 | 
|---|
 | 1486 |     template<class T1>
 | 
|---|
 | 1487 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1488 |         const T1& a)
 | 
|---|
 | 1489 |     {
 | 
|---|
 | 1490 |         str += "log(";
 | 
|---|
 | 1491 |         a.prettyPrint(str,format);
 | 
|---|
 | 1492 |         str += ")";
 | 
|---|
 | 1493 |     }
 | 
|---|
 | 1494 | };
 | 
|---|
 | 1495 | #endif
 | 
|---|
 | 1496 | 
 | 
|---|
 | 1497 | // log(complex<double> )
 | 
|---|
 | 1498 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 1499 | template<>
 | 
|---|
 | 1500 | class _bz_log<complex<double> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1501 | public:
 | 
|---|
 | 1502 |     typedef complex<double>  T_numtype1;
 | 
|---|
 | 1503 |     typedef complex<double> T_numtype;
 | 
|---|
 | 1504 | 
 | 
|---|
 | 1505 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1506 |     { return BZ_CMATHFN_SCOPE(log)((complex<double> )x); }
 | 
|---|
 | 1507 | 
 | 
|---|
 | 1508 |     template<class T1>
 | 
|---|
 | 1509 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1510 |         const T1& a)
 | 
|---|
 | 1511 |     {
 | 
|---|
 | 1512 |         str += "log(";
 | 
|---|
 | 1513 |         a.prettyPrint(str,format);
 | 
|---|
 | 1514 |         str += ")";
 | 
|---|
 | 1515 |     }
 | 
|---|
 | 1516 | };
 | 
|---|
 | 1517 | #endif
 | 
|---|
 | 1518 | 
 | 
|---|
 | 1519 | // log(complex<long double> )
 | 
|---|
 | 1520 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 1521 | template<>
 | 
|---|
 | 1522 | class _bz_log<complex<long double> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1523 | public:
 | 
|---|
 | 1524 |     typedef complex<long double>  T_numtype1;
 | 
|---|
 | 1525 |     typedef complex<long double> T_numtype;
 | 
|---|
 | 1526 | 
 | 
|---|
 | 1527 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1528 |     { return BZ_CMATHFN_SCOPE(log)((complex<long double> )x); }
 | 
|---|
 | 1529 | 
 | 
|---|
 | 1530 |     template<class T1>
 | 
|---|
 | 1531 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1532 |         const T1& a)
 | 
|---|
 | 1533 |     {
 | 
|---|
 | 1534 |         str += "log(";
 | 
|---|
 | 1535 |         a.prettyPrint(str,format);
 | 
|---|
 | 1536 |         str += ")";
 | 
|---|
 | 1537 |     }
 | 
|---|
 | 1538 | };
 | 
|---|
 | 1539 | #endif
 | 
|---|
 | 1540 | 
 | 
|---|
 | 1541 | // logb(P_numtype1)    Unbiased exponent (IEEE)
 | 
|---|
 | 1542 | #ifdef BZ_HAVE_IEEE_MATH
 | 
|---|
 | 1543 | template<class P_numtype1>
 | 
|---|
 | 1544 | class _bz_logb : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1545 | public:
 | 
|---|
 | 1546 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 1547 |     typedef double T_numtype;
 | 
|---|
 | 1548 | 
 | 
|---|
 | 1549 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1550 |     { return BZ_MATHFN_SCOPE(logb)((double)x); }
 | 
|---|
 | 1551 | 
 | 
|---|
 | 1552 |     template<class T1>
 | 
|---|
 | 1553 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1554 |         const T1& a)
 | 
|---|
 | 1555 |     {
 | 
|---|
 | 1556 |         str += "logb(";
 | 
|---|
 | 1557 |         a.prettyPrint(str,format);
 | 
|---|
 | 1558 |         str += ")";
 | 
|---|
 | 1559 |     }
 | 
|---|
 | 1560 | };
 | 
|---|
 | 1561 | #endif
 | 
|---|
 | 1562 | 
 | 
|---|
 | 1563 | // log1p(P_numtype1)    Compute log(1 + x)
 | 
|---|
 | 1564 | #ifdef BZ_HAVE_IEEE_MATH
 | 
|---|
 | 1565 | template<class P_numtype1>
 | 
|---|
 | 1566 | class _bz_log1p : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1567 | public:
 | 
|---|
 | 1568 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 1569 |     typedef double T_numtype;
 | 
|---|
 | 1570 | 
 | 
|---|
 | 1571 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1572 |     { return BZ_MATHFN_SCOPE(log1p)((double)x); }
 | 
|---|
 | 1573 | 
 | 
|---|
 | 1574 |     template<class T1>
 | 
|---|
 | 1575 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1576 |         const T1& a)
 | 
|---|
 | 1577 |     {
 | 
|---|
 | 1578 |         str += "log1p(";
 | 
|---|
 | 1579 |         a.prettyPrint(str,format);
 | 
|---|
 | 1580 |         str += ")";
 | 
|---|
 | 1581 |     }
 | 
|---|
 | 1582 | };
 | 
|---|
 | 1583 | #endif
 | 
|---|
 | 1584 | 
 | 
|---|
 | 1585 | // log10(P_numtype1)    Logarithm base 10
 | 
|---|
 | 1586 | template<class P_numtype1>
 | 
|---|
 | 1587 | class _bz_log10 : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1588 | public:
 | 
|---|
 | 1589 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 1590 |     typedef double T_numtype;
 | 
|---|
 | 1591 | 
 | 
|---|
 | 1592 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1593 |     { return BZ_MATHFN_SCOPE(log10)((double)x); }
 | 
|---|
 | 1594 | 
 | 
|---|
 | 1595 |     template<class T1>
 | 
|---|
 | 1596 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1597 |         const T1& a)
 | 
|---|
 | 1598 |     {
 | 
|---|
 | 1599 |         str += "log10(";
 | 
|---|
 | 1600 |         a.prettyPrint(str,format);
 | 
|---|
 | 1601 |         str += ")";
 | 
|---|
 | 1602 |     }
 | 
|---|
 | 1603 | };
 | 
|---|
 | 1604 | 
 | 
|---|
 | 1605 | // log10(float)
 | 
|---|
 | 1606 | template<>
 | 
|---|
 | 1607 | class _bz_log10<float> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1608 | public:
 | 
|---|
 | 1609 |     typedef float T_numtype1;
 | 
|---|
 | 1610 |     typedef float T_numtype;
 | 
|---|
 | 1611 | 
 | 
|---|
 | 1612 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1613 |     { return BZ_MATHFN_SCOPE(log10)((float)x); }
 | 
|---|
 | 1614 | 
 | 
|---|
 | 1615 |     template<class T1>
 | 
|---|
 | 1616 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1617 |         const T1& a)
 | 
|---|
 | 1618 |     {
 | 
|---|
 | 1619 |         str += "log10(";
 | 
|---|
 | 1620 |         a.prettyPrint(str,format);
 | 
|---|
 | 1621 |         str += ")";
 | 
|---|
 | 1622 |     }
 | 
|---|
 | 1623 | };
 | 
|---|
 | 1624 | 
 | 
|---|
 | 1625 | // log10(long double)
 | 
|---|
 | 1626 | template<>
 | 
|---|
 | 1627 | class _bz_log10<long double> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1628 | public:
 | 
|---|
 | 1629 |     typedef long double T_numtype1;
 | 
|---|
 | 1630 |     typedef long double T_numtype;
 | 
|---|
 | 1631 | 
 | 
|---|
 | 1632 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1633 |     { return BZ_MATHFN_SCOPE(log10)((long double)x); }
 | 
|---|
 | 1634 | 
 | 
|---|
 | 1635 |     template<class T1>
 | 
|---|
 | 1636 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1637 |         const T1& a)
 | 
|---|
 | 1638 |     {
 | 
|---|
 | 1639 |         str += "log10(";
 | 
|---|
 | 1640 |         a.prettyPrint(str,format);
 | 
|---|
 | 1641 |         str += ")";
 | 
|---|
 | 1642 |     }
 | 
|---|
 | 1643 | };
 | 
|---|
 | 1644 | 
 | 
|---|
 | 1645 | // log10(complex<float> )
 | 
|---|
 | 1646 | #ifdef BZ_HAVE_COMPLEX_MATH2
 | 
|---|
 | 1647 | template<>
 | 
|---|
 | 1648 | class _bz_log10<complex<float> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1649 | public:
 | 
|---|
 | 1650 |     typedef complex<float>  T_numtype1;
 | 
|---|
 | 1651 |     typedef complex<float> T_numtype;
 | 
|---|
 | 1652 | 
 | 
|---|
 | 1653 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1654 |     { return BZ_CMATHFN_SCOPE(log10)((complex<float> )x); }
 | 
|---|
 | 1655 | 
 | 
|---|
 | 1656 |     template<class T1>
 | 
|---|
 | 1657 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1658 |         const T1& a)
 | 
|---|
 | 1659 |     {
 | 
|---|
 | 1660 |         str += "log10(";
 | 
|---|
 | 1661 |         a.prettyPrint(str,format);
 | 
|---|
 | 1662 |         str += ")";
 | 
|---|
 | 1663 |     }
 | 
|---|
 | 1664 | };
 | 
|---|
 | 1665 | #endif
 | 
|---|
 | 1666 | 
 | 
|---|
 | 1667 | // log10(complex<double> )
 | 
|---|
 | 1668 | #ifdef BZ_HAVE_COMPLEX_MATH2
 | 
|---|
 | 1669 | template<>
 | 
|---|
 | 1670 | class _bz_log10<complex<double> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1671 | public:
 | 
|---|
 | 1672 |     typedef complex<double>  T_numtype1;
 | 
|---|
 | 1673 |     typedef complex<double> T_numtype;
 | 
|---|
 | 1674 | 
 | 
|---|
 | 1675 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1676 |     { return BZ_CMATHFN_SCOPE(log10)((complex<double> )x); }
 | 
|---|
 | 1677 | 
 | 
|---|
 | 1678 |     template<class T1>
 | 
|---|
 | 1679 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1680 |         const T1& a)
 | 
|---|
 | 1681 |     {
 | 
|---|
 | 1682 |         str += "log10(";
 | 
|---|
 | 1683 |         a.prettyPrint(str,format);
 | 
|---|
 | 1684 |         str += ")";
 | 
|---|
 | 1685 |     }
 | 
|---|
 | 1686 | };
 | 
|---|
 | 1687 | #endif
 | 
|---|
 | 1688 | 
 | 
|---|
 | 1689 | // log10(complex<long double> )
 | 
|---|
 | 1690 | #ifdef BZ_HAVE_COMPLEX_MATH2
 | 
|---|
 | 1691 | template<>
 | 
|---|
 | 1692 | class _bz_log10<complex<long double> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1693 | public:
 | 
|---|
 | 1694 |     typedef complex<long double>  T_numtype1;
 | 
|---|
 | 1695 |     typedef complex<long double> T_numtype;
 | 
|---|
 | 1696 | 
 | 
|---|
 | 1697 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1698 |     { return BZ_CMATHFN_SCOPE(log10)((complex<long double> )x); }
 | 
|---|
 | 1699 | 
 | 
|---|
 | 1700 |     template<class T1>
 | 
|---|
 | 1701 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1702 |         const T1& a)
 | 
|---|
 | 1703 |     {
 | 
|---|
 | 1704 |         str += "log10(";
 | 
|---|
 | 1705 |         a.prettyPrint(str,format);
 | 
|---|
 | 1706 |         str += ")";
 | 
|---|
 | 1707 |     }
 | 
|---|
 | 1708 | };
 | 
|---|
 | 1709 | #endif
 | 
|---|
 | 1710 | 
 | 
|---|
 | 1711 | // nearest(P_numtype1)    Nearest floating point integer
 | 
|---|
 | 1712 | #ifdef BZ_HAVE_SYSTEM_V_MATH
 | 
|---|
 | 1713 | template<class P_numtype1>
 | 
|---|
 | 1714 | class _bz_nearest : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1715 | public:
 | 
|---|
 | 1716 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 1717 |     typedef double T_numtype;
 | 
|---|
 | 1718 | 
 | 
|---|
 | 1719 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1720 |     { return BZ_MATHFN_SCOPE(nearest)((double)x); }
 | 
|---|
 | 1721 | 
 | 
|---|
 | 1722 |     template<class T1>
 | 
|---|
 | 1723 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1724 |         const T1& a)
 | 
|---|
 | 1725 |     {
 | 
|---|
 | 1726 |         str += "nearest(";
 | 
|---|
 | 1727 |         a.prettyPrint(str,format);
 | 
|---|
 | 1728 |         str += ")";
 | 
|---|
 | 1729 |     }
 | 
|---|
 | 1730 | };
 | 
|---|
 | 1731 | #endif
 | 
|---|
 | 1732 | 
 | 
|---|
 | 1733 | // nextafter(P_numtype1, P_numtype2)    Next representable number after x towards y
 | 
|---|
 | 1734 | #ifdef BZ_HAVE_SYSTEM_V_MATH
 | 
|---|
 | 1735 | template<class P_numtype1, class P_numtype2>
 | 
|---|
 | 1736 | class _bz_nextafter : public TwoOperandApplicativeTemplatesBase {
 | 
|---|
 | 1737 | public:
 | 
|---|
 | 1738 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 1739 |     typedef P_numtype2 T_numtype2;
 | 
|---|
 | 1740 |     typedef double T_numtype;
 | 
|---|
 | 1741 | 
 | 
|---|
 | 1742 |     static inline T_numtype apply(T_numtype1 x, T_numtype2 y)
 | 
|---|
 | 1743 |     { return BZ_MATHFN_SCOPE(nextafter)((double)x,(double)y); }
 | 
|---|
 | 1744 | };
 | 
|---|
 | 1745 | #endif
 | 
|---|
 | 1746 | 
 | 
|---|
 | 1747 | template<class P_numtype>
 | 
|---|
 | 1748 | class _bz_negate : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1749 | public:
 | 
|---|
 | 1750 |     typedef BZ_SIGNEDTYPE(P_numtype) T_numtype;
 | 
|---|
 | 1751 | 
 | 
|---|
 | 1752 |     static inline T_numtype apply(T_numtype x)
 | 
|---|
 | 1753 |     { return -x; }
 | 
|---|
 | 1754 | };
 | 
|---|
 | 1755 | 
 | 
|---|
 | 1756 | // pow(P_numtype1, P_numtype2)    Power
 | 
|---|
 | 1757 | template<class P_numtype1, class P_numtype2>
 | 
|---|
 | 1758 | class _bz_pow : public TwoOperandApplicativeTemplatesBase {
 | 
|---|
 | 1759 | public:
 | 
|---|
 | 1760 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 1761 |     typedef P_numtype2 T_numtype2;
 | 
|---|
 | 1762 |     typedef double T_numtype;
 | 
|---|
 | 1763 | 
 | 
|---|
 | 1764 |     static inline T_numtype apply(T_numtype1 x, T_numtype2 y)
 | 
|---|
 | 1765 |     { return BZ_MATHFN_SCOPE(pow)((double)x,(double)y); }
 | 
|---|
 | 1766 | };
 | 
|---|
 | 1767 | 
 | 
|---|
 | 1768 | // pow(float, float)
 | 
|---|
 | 1769 | template<>
 | 
|---|
 | 1770 | class _bz_pow<float, float > : public TwoOperandApplicativeTemplatesBase {
 | 
|---|
 | 1771 | public:
 | 
|---|
 | 1772 |     typedef float T_numtype1;
 | 
|---|
 | 1773 |     typedef float T_numtype2;
 | 
|---|
 | 1774 |     typedef float T_numtype;
 | 
|---|
 | 1775 | 
 | 
|---|
 | 1776 |     static inline T_numtype apply(T_numtype1 x, T_numtype2 y)
 | 
|---|
 | 1777 |     { return BZ_MATHFN_SCOPE(pow)((float)x,(float)y); }
 | 
|---|
 | 1778 | };
 | 
|---|
 | 1779 | 
 | 
|---|
 | 1780 | // pow(long double, long double)
 | 
|---|
 | 1781 | template<>
 | 
|---|
 | 1782 | class _bz_pow<long double, long double > : public TwoOperandApplicativeTemplatesBase {
 | 
|---|
 | 1783 | public:
 | 
|---|
 | 1784 |     typedef long double T_numtype1;
 | 
|---|
 | 1785 |     typedef long double T_numtype2;
 | 
|---|
 | 1786 |     typedef long double T_numtype;
 | 
|---|
 | 1787 | 
 | 
|---|
 | 1788 |     static inline T_numtype apply(T_numtype1 x, T_numtype2 y)
 | 
|---|
 | 1789 |     { return BZ_MATHFN_SCOPE(pow)((long double)x,(long double)y); }
 | 
|---|
 | 1790 | };
 | 
|---|
 | 1791 | 
 | 
|---|
 | 1792 | // pow(complex<float>, complex<float>)
 | 
|---|
 | 1793 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 1794 | template<>
 | 
|---|
 | 1795 | class _bz_pow<complex<float>, complex<float> > : public TwoOperandApplicativeTemplatesBase {
 | 
|---|
 | 1796 | public:
 | 
|---|
 | 1797 |     typedef complex<float> T_numtype1;
 | 
|---|
 | 1798 |     typedef complex<float> T_numtype2;
 | 
|---|
 | 1799 |     typedef complex<float> T_numtype;
 | 
|---|
 | 1800 | 
 | 
|---|
 | 1801 |     static inline T_numtype apply(T_numtype1 x, T_numtype2 y)
 | 
|---|
 | 1802 |     { return BZ_CMATHFN_SCOPE(pow)((complex<float>)x,(complex<float>)y); }
 | 
|---|
 | 1803 | };
 | 
|---|
 | 1804 | #endif
 | 
|---|
 | 1805 | 
 | 
|---|
 | 1806 | // pow(complex<double>, complex<double>)
 | 
|---|
 | 1807 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 1808 | template<>
 | 
|---|
 | 1809 | class _bz_pow<complex<double>, complex<double> > : public TwoOperandApplicativeTemplatesBase {
 | 
|---|
 | 1810 | public:
 | 
|---|
 | 1811 |     typedef complex<double> T_numtype1;
 | 
|---|
 | 1812 |     typedef complex<double> T_numtype2;
 | 
|---|
 | 1813 |     typedef complex<double> T_numtype;
 | 
|---|
 | 1814 | 
 | 
|---|
 | 1815 |     static inline T_numtype apply(T_numtype1 x, T_numtype2 y)
 | 
|---|
 | 1816 |     { return BZ_CMATHFN_SCOPE(pow)((complex<double>)x,(complex<double>)y); }
 | 
|---|
 | 1817 | };
 | 
|---|
 | 1818 | #endif
 | 
|---|
 | 1819 | 
 | 
|---|
 | 1820 | // pow(complex<long double>, complex<long double>)
 | 
|---|
 | 1821 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 1822 | template<>
 | 
|---|
 | 1823 | class _bz_pow<complex<long double>, complex<long double> > : public TwoOperandApplicativeTemplatesBase {
 | 
|---|
 | 1824 | public:
 | 
|---|
 | 1825 |     typedef complex<long double> T_numtype1;
 | 
|---|
 | 1826 |     typedef complex<long double> T_numtype2;
 | 
|---|
 | 1827 |     typedef complex<long double> T_numtype;
 | 
|---|
 | 1828 | 
 | 
|---|
 | 1829 |     static inline T_numtype apply(T_numtype1 x, T_numtype2 y)
 | 
|---|
 | 1830 |     { return BZ_CMATHFN_SCOPE(pow)((complex<long double>)x,(complex<long double>)y); }
 | 
|---|
 | 1831 | };
 | 
|---|
 | 1832 | #endif
 | 
|---|
 | 1833 | 
 | 
|---|
 | 1834 | // remainder(P_numtype1, P_numtype2)    Remainder
 | 
|---|
 | 1835 | #ifdef BZ_HAVE_SYSTEM_V_MATH
 | 
|---|
 | 1836 | template<class P_numtype1, class P_numtype2>
 | 
|---|
 | 1837 | class _bz_remainder : public TwoOperandApplicativeTemplatesBase {
 | 
|---|
 | 1838 | public:
 | 
|---|
 | 1839 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 1840 |     typedef P_numtype2 T_numtype2;
 | 
|---|
 | 1841 |     typedef double T_numtype;
 | 
|---|
 | 1842 | 
 | 
|---|
 | 1843 |     static inline T_numtype apply(T_numtype1 x, T_numtype2 y)
 | 
|---|
 | 1844 |     { return BZ_MATHFN_SCOPE(remainder)((double)x,(double)y); }
 | 
|---|
 | 1845 | };
 | 
|---|
 | 1846 | #endif
 | 
|---|
 | 1847 | 
 | 
|---|
 | 1848 | // rint(P_numtype1)    Round to floating point integer
 | 
|---|
 | 1849 | #ifdef BZ_HAVE_IEEE_MATH
 | 
|---|
 | 1850 | template<class P_numtype1>
 | 
|---|
 | 1851 | class _bz_rint : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1852 | public:
 | 
|---|
 | 1853 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 1854 |     typedef double T_numtype;
 | 
|---|
 | 1855 | 
 | 
|---|
 | 1856 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1857 |     { return BZ_MATHFN_SCOPE(rint)((double)x); }
 | 
|---|
 | 1858 | 
 | 
|---|
 | 1859 |     template<class T1>
 | 
|---|
 | 1860 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1861 |         const T1& a)
 | 
|---|
 | 1862 |     {
 | 
|---|
 | 1863 |         str += "rint(";
 | 
|---|
 | 1864 |         a.prettyPrint(str,format);
 | 
|---|
 | 1865 |         str += ")";
 | 
|---|
 | 1866 |     }
 | 
|---|
 | 1867 | };
 | 
|---|
 | 1868 | #endif
 | 
|---|
 | 1869 | 
 | 
|---|
 | 1870 | // rsqrt(P_numtype1)    Reciprocal square root
 | 
|---|
 | 1871 | #ifdef BZ_HAVE_SYSTEM_V_MATH
 | 
|---|
 | 1872 | template<class P_numtype1>
 | 
|---|
 | 1873 | class _bz_rsqrt : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1874 | public:
 | 
|---|
 | 1875 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 1876 |     typedef double T_numtype;
 | 
|---|
 | 1877 | 
 | 
|---|
 | 1878 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1879 |     { return BZ_MATHFN_SCOPE(rsqrt)((double)x); }
 | 
|---|
 | 1880 | 
 | 
|---|
 | 1881 |     template<class T1>
 | 
|---|
 | 1882 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1883 |         const T1& a)
 | 
|---|
 | 1884 |     {
 | 
|---|
 | 1885 |         str += "rsqrt(";
 | 
|---|
 | 1886 |         a.prettyPrint(str,format);
 | 
|---|
 | 1887 |         str += ")";
 | 
|---|
 | 1888 |     }
 | 
|---|
 | 1889 | };
 | 
|---|
 | 1890 | #endif
 | 
|---|
 | 1891 | 
 | 
|---|
 | 1892 | // scalb(P_numtype1, P_numtype2)    x * (2**y)
 | 
|---|
 | 1893 | #ifdef BZ_HAVE_SYSTEM_V_MATH
 | 
|---|
 | 1894 | template<class P_numtype1, class P_numtype2>
 | 
|---|
 | 1895 | class _bz_scalb : public TwoOperandApplicativeTemplatesBase {
 | 
|---|
 | 1896 | public:
 | 
|---|
 | 1897 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 1898 |     typedef P_numtype2 T_numtype2;
 | 
|---|
 | 1899 |     typedef double T_numtype;
 | 
|---|
 | 1900 | 
 | 
|---|
 | 1901 |     static inline T_numtype apply(T_numtype1 x, T_numtype2 y)
 | 
|---|
 | 1902 |     { return BZ_MATHFN_SCOPE(scalb)((double)x,(double)y); }
 | 
|---|
 | 1903 | };
 | 
|---|
 | 1904 | #endif
 | 
|---|
 | 1905 | 
 | 
|---|
 | 1906 | // sin(P_numtype1)    Sine
 | 
|---|
 | 1907 | template<class P_numtype1>
 | 
|---|
 | 1908 | class _bz_sin : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1909 | public:
 | 
|---|
 | 1910 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 1911 |     typedef double T_numtype;
 | 
|---|
 | 1912 | 
 | 
|---|
 | 1913 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1914 |     { return BZ_MATHFN_SCOPE(sin)((double)x); }
 | 
|---|
 | 1915 | 
 | 
|---|
 | 1916 |     template<class T1>
 | 
|---|
 | 1917 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1918 |         const T1& a)
 | 
|---|
 | 1919 |     {
 | 
|---|
 | 1920 |         str += "sin(";
 | 
|---|
 | 1921 |         a.prettyPrint(str,format);
 | 
|---|
 | 1922 |         str += ")";
 | 
|---|
 | 1923 |     }
 | 
|---|
 | 1924 | };
 | 
|---|
 | 1925 | 
 | 
|---|
 | 1926 | // sin(float)
 | 
|---|
 | 1927 | template<>
 | 
|---|
 | 1928 | class _bz_sin<float> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1929 | public:
 | 
|---|
 | 1930 |     typedef float T_numtype1;
 | 
|---|
 | 1931 |     typedef float T_numtype;
 | 
|---|
 | 1932 | 
 | 
|---|
 | 1933 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1934 |     { return BZ_MATHFN_SCOPE(sin)((float)x); }
 | 
|---|
 | 1935 | 
 | 
|---|
 | 1936 |     template<class T1>
 | 
|---|
 | 1937 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1938 |         const T1& a)
 | 
|---|
 | 1939 |     {
 | 
|---|
 | 1940 |         str += "sin(";
 | 
|---|
 | 1941 |         a.prettyPrint(str,format);
 | 
|---|
 | 1942 |         str += ")";
 | 
|---|
 | 1943 |     }
 | 
|---|
 | 1944 | };
 | 
|---|
 | 1945 | 
 | 
|---|
 | 1946 | // sin(long double)
 | 
|---|
 | 1947 | template<>
 | 
|---|
 | 1948 | class _bz_sin<long double> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1949 | public:
 | 
|---|
 | 1950 |     typedef long double T_numtype1;
 | 
|---|
 | 1951 |     typedef long double T_numtype;
 | 
|---|
 | 1952 | 
 | 
|---|
 | 1953 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1954 |     { return BZ_MATHFN_SCOPE(sin)((long double)x); }
 | 
|---|
 | 1955 | 
 | 
|---|
 | 1956 |     template<class T1>
 | 
|---|
 | 1957 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1958 |         const T1& a)
 | 
|---|
 | 1959 |     {
 | 
|---|
 | 1960 |         str += "sin(";
 | 
|---|
 | 1961 |         a.prettyPrint(str,format);
 | 
|---|
 | 1962 |         str += ")";
 | 
|---|
 | 1963 |     }
 | 
|---|
 | 1964 | };
 | 
|---|
 | 1965 | 
 | 
|---|
 | 1966 | // sin(complex<float> )
 | 
|---|
 | 1967 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 1968 | template<>
 | 
|---|
 | 1969 | class _bz_sin<complex<float> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1970 | public:
 | 
|---|
 | 1971 |     typedef complex<float>  T_numtype1;
 | 
|---|
 | 1972 |     typedef complex<float> T_numtype;
 | 
|---|
 | 1973 | 
 | 
|---|
 | 1974 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1975 |     { return BZ_CMATHFN_SCOPE(sin)((complex<float> )x); }
 | 
|---|
 | 1976 | 
 | 
|---|
 | 1977 |     template<class T1>
 | 
|---|
 | 1978 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 1979 |         const T1& a)
 | 
|---|
 | 1980 |     {
 | 
|---|
 | 1981 |         str += "sin(";
 | 
|---|
 | 1982 |         a.prettyPrint(str,format);
 | 
|---|
 | 1983 |         str += ")";
 | 
|---|
 | 1984 |     }
 | 
|---|
 | 1985 | };
 | 
|---|
 | 1986 | #endif
 | 
|---|
 | 1987 | 
 | 
|---|
 | 1988 | // sin(complex<double> )
 | 
|---|
 | 1989 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 1990 | template<>
 | 
|---|
 | 1991 | class _bz_sin<complex<double> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 1992 | public:
 | 
|---|
 | 1993 |     typedef complex<double>  T_numtype1;
 | 
|---|
 | 1994 |     typedef complex<double> T_numtype;
 | 
|---|
 | 1995 | 
 | 
|---|
 | 1996 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 1997 |     { return BZ_CMATHFN_SCOPE(sin)((complex<double> )x); }
 | 
|---|
 | 1998 | 
 | 
|---|
 | 1999 |     template<class T1>
 | 
|---|
 | 2000 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2001 |         const T1& a)
 | 
|---|
 | 2002 |     {
 | 
|---|
 | 2003 |         str += "sin(";
 | 
|---|
 | 2004 |         a.prettyPrint(str,format);
 | 
|---|
 | 2005 |         str += ")";
 | 
|---|
 | 2006 |     }
 | 
|---|
 | 2007 | };
 | 
|---|
 | 2008 | #endif
 | 
|---|
 | 2009 | 
 | 
|---|
 | 2010 | // sin(complex<long double> )
 | 
|---|
 | 2011 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 2012 | template<>
 | 
|---|
 | 2013 | class _bz_sin<complex<long double> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2014 | public:
 | 
|---|
 | 2015 |     typedef complex<long double>  T_numtype1;
 | 
|---|
 | 2016 |     typedef complex<long double> T_numtype;
 | 
|---|
 | 2017 | 
 | 
|---|
 | 2018 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 2019 |     { return BZ_CMATHFN_SCOPE(sin)((complex<long double> )x); }
 | 
|---|
 | 2020 | 
 | 
|---|
 | 2021 |     template<class T1>
 | 
|---|
 | 2022 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2023 |         const T1& a)
 | 
|---|
 | 2024 |     {
 | 
|---|
 | 2025 |         str += "sin(";
 | 
|---|
 | 2026 |         a.prettyPrint(str,format);
 | 
|---|
 | 2027 |         str += ")";
 | 
|---|
 | 2028 |     }
 | 
|---|
 | 2029 | };
 | 
|---|
 | 2030 | #endif
 | 
|---|
 | 2031 | 
 | 
|---|
 | 2032 | // sinh(P_numtype1)    Hyperbolic sine
 | 
|---|
 | 2033 | template<class P_numtype1>
 | 
|---|
 | 2034 | class _bz_sinh : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2035 | public:
 | 
|---|
 | 2036 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 2037 |     typedef double T_numtype;
 | 
|---|
 | 2038 | 
 | 
|---|
 | 2039 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 2040 |     { return BZ_MATHFN_SCOPE(sinh)((double)x); }
 | 
|---|
 | 2041 | 
 | 
|---|
 | 2042 |     template<class T1>
 | 
|---|
 | 2043 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2044 |         const T1& a)
 | 
|---|
 | 2045 |     {
 | 
|---|
 | 2046 |         str += "sinh(";
 | 
|---|
 | 2047 |         a.prettyPrint(str,format);
 | 
|---|
 | 2048 |         str += ")";
 | 
|---|
 | 2049 |     }
 | 
|---|
 | 2050 | };
 | 
|---|
 | 2051 | 
 | 
|---|
 | 2052 | // sinh(float)
 | 
|---|
 | 2053 | template<>
 | 
|---|
 | 2054 | class _bz_sinh<float> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2055 | public:
 | 
|---|
 | 2056 |     typedef float T_numtype1;
 | 
|---|
 | 2057 |     typedef float T_numtype;
 | 
|---|
 | 2058 | 
 | 
|---|
 | 2059 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 2060 |     { return BZ_MATHFN_SCOPE(sinh)((float)x); }
 | 
|---|
 | 2061 | 
 | 
|---|
 | 2062 |     template<class T1>
 | 
|---|
 | 2063 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2064 |         const T1& a)
 | 
|---|
 | 2065 |     {
 | 
|---|
 | 2066 |         str += "sinh(";
 | 
|---|
 | 2067 |         a.prettyPrint(str,format);
 | 
|---|
 | 2068 |         str += ")";
 | 
|---|
 | 2069 |     }
 | 
|---|
 | 2070 | };
 | 
|---|
 | 2071 | 
 | 
|---|
 | 2072 | // sinh(long double)
 | 
|---|
 | 2073 | template<>
 | 
|---|
 | 2074 | class _bz_sinh<long double> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2075 | public:
 | 
|---|
 | 2076 |     typedef long double T_numtype1;
 | 
|---|
 | 2077 |     typedef long double T_numtype;
 | 
|---|
 | 2078 | 
 | 
|---|
 | 2079 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 2080 |     { return BZ_MATHFN_SCOPE(sinh)((long double)x); }
 | 
|---|
 | 2081 | 
 | 
|---|
 | 2082 |     template<class T1>
 | 
|---|
 | 2083 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2084 |         const T1& a)
 | 
|---|
 | 2085 |     {
 | 
|---|
 | 2086 |         str += "sinh(";
 | 
|---|
 | 2087 |         a.prettyPrint(str,format);
 | 
|---|
 | 2088 |         str += ")";
 | 
|---|
 | 2089 |     }
 | 
|---|
 | 2090 | };
 | 
|---|
 | 2091 | 
 | 
|---|
 | 2092 | // sinh(complex<float> )
 | 
|---|
 | 2093 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 2094 | template<>
 | 
|---|
 | 2095 | class _bz_sinh<complex<float> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2096 | public:
 | 
|---|
 | 2097 |     typedef complex<float>  T_numtype1;
 | 
|---|
 | 2098 |     typedef complex<float> T_numtype;
 | 
|---|
 | 2099 | 
 | 
|---|
 | 2100 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 2101 |     { return BZ_CMATHFN_SCOPE(sinh)((complex<float> )x); }
 | 
|---|
 | 2102 | 
 | 
|---|
 | 2103 |     template<class T1>
 | 
|---|
 | 2104 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2105 |         const T1& a)
 | 
|---|
 | 2106 |     {
 | 
|---|
 | 2107 |         str += "sinh(";
 | 
|---|
 | 2108 |         a.prettyPrint(str,format);
 | 
|---|
 | 2109 |         str += ")";
 | 
|---|
 | 2110 |     }
 | 
|---|
 | 2111 | };
 | 
|---|
 | 2112 | #endif
 | 
|---|
 | 2113 | 
 | 
|---|
 | 2114 | // sinh(complex<double> )
 | 
|---|
 | 2115 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 2116 | template<>
 | 
|---|
 | 2117 | class _bz_sinh<complex<double> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2118 | public:
 | 
|---|
 | 2119 |     typedef complex<double>  T_numtype1;
 | 
|---|
 | 2120 |     typedef complex<double> T_numtype;
 | 
|---|
 | 2121 | 
 | 
|---|
 | 2122 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 2123 |     { return BZ_CMATHFN_SCOPE(sinh)((complex<double> )x); }
 | 
|---|
 | 2124 | 
 | 
|---|
 | 2125 |     template<class T1>
 | 
|---|
 | 2126 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2127 |         const T1& a)
 | 
|---|
 | 2128 |     {
 | 
|---|
 | 2129 |         str += "sinh(";
 | 
|---|
 | 2130 |         a.prettyPrint(str,format);
 | 
|---|
 | 2131 |         str += ")";
 | 
|---|
 | 2132 |     }
 | 
|---|
 | 2133 | };
 | 
|---|
 | 2134 | #endif
 | 
|---|
 | 2135 | 
 | 
|---|
 | 2136 | // sinh(complex<long double> )
 | 
|---|
 | 2137 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 2138 | template<>
 | 
|---|
 | 2139 | class _bz_sinh<complex<long double> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2140 | public:
 | 
|---|
 | 2141 |     typedef complex<long double>  T_numtype1;
 | 
|---|
 | 2142 |     typedef complex<long double> T_numtype;
 | 
|---|
 | 2143 | 
 | 
|---|
 | 2144 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 2145 |     { return BZ_CMATHFN_SCOPE(sinh)((complex<long double> )x); }
 | 
|---|
 | 2146 | 
 | 
|---|
 | 2147 |     template<class T1>
 | 
|---|
 | 2148 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2149 |         const T1& a)
 | 
|---|
 | 2150 |     {
 | 
|---|
 | 2151 |         str += "sinh(";
 | 
|---|
 | 2152 |         a.prettyPrint(str,format);
 | 
|---|
 | 2153 |         str += ")";
 | 
|---|
 | 2154 |     }
 | 
|---|
 | 2155 | };
 | 
|---|
 | 2156 | #endif
 | 
|---|
 | 2157 | 
 | 
|---|
 | 2158 | template<class P_numtype>
 | 
|---|
 | 2159 | class _bz_sqr : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2160 | public:
 | 
|---|
 | 2161 |     typedef P_numtype T_numtype;
 | 
|---|
 | 2162 | 
 | 
|---|
 | 2163 |     static inline T_numtype apply(T_numtype x)
 | 
|---|
 | 2164 |     { return x*x; }
 | 
|---|
 | 2165 |     template<class T1>
 | 
|---|
 | 2166 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2167 |         const T1& a)
 | 
|---|
 | 2168 |     {
 | 
|---|
 | 2169 |         str += "sqr(";
 | 
|---|
 | 2170 |         a.prettyPrint(str,format);
 | 
|---|
 | 2171 |         str += ")";
 | 
|---|
 | 2172 |     }
 | 
|---|
 | 2173 | };
 | 
|---|
 | 2174 | 
 | 
|---|
 | 2175 | // Specialization of _bz_sqr for complex<T>
 | 
|---|
 | 2176 | template<class T>
 | 
|---|
 | 2177 | class _bz_sqr<complex<T> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2178 | public:
 | 
|---|
 | 2179 |     typedef complex<T> T_numtype;
 | 
|---|
 | 2180 | 
 | 
|---|
 | 2181 |     static inline T_numtype apply(T_numtype x)
 | 
|---|
 | 2182 |     {
 | 
|---|
 | 2183 |         T r = x.real();  T i = x.imag();
 | 
|---|
 | 2184 |         return T_numtype(r*r-i*i, 2*r*i);
 | 
|---|
 | 2185 |     }
 | 
|---|
 | 2186 |     template<class T1>
 | 
|---|
 | 2187 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2188 |         const T1& a)
 | 
|---|
 | 2189 |     {
 | 
|---|
 | 2190 |         str += "sqr(";
 | 
|---|
 | 2191 |         a.prettyPrint(str,format);
 | 
|---|
 | 2192 |         str += ")";
 | 
|---|
 | 2193 |     }
 | 
|---|
 | 2194 | };
 | 
|---|
 | 2195 | 
 | 
|---|
 | 2196 | // sqrt(P_numtype1)    Square root
 | 
|---|
 | 2197 | template<class P_numtype1>
 | 
|---|
 | 2198 | class _bz_sqrt : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2199 | public:
 | 
|---|
 | 2200 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 2201 |     typedef double T_numtype;
 | 
|---|
 | 2202 | 
 | 
|---|
 | 2203 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 2204 |     { return BZ_MATHFN_SCOPE(sqrt)((double)x); }
 | 
|---|
 | 2205 | 
 | 
|---|
 | 2206 |     template<class T1>
 | 
|---|
 | 2207 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2208 |         const T1& a)
 | 
|---|
 | 2209 |     {
 | 
|---|
 | 2210 |         str += "sqrt(";
 | 
|---|
 | 2211 |         a.prettyPrint(str,format);
 | 
|---|
 | 2212 |         str += ")";
 | 
|---|
 | 2213 |     }
 | 
|---|
 | 2214 | };
 | 
|---|
 | 2215 | 
 | 
|---|
 | 2216 | // sqrt(float)
 | 
|---|
 | 2217 | template<>
 | 
|---|
 | 2218 | class _bz_sqrt<float> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2219 | public:
 | 
|---|
 | 2220 |     typedef float T_numtype1;
 | 
|---|
 | 2221 |     typedef float T_numtype;
 | 
|---|
 | 2222 | 
 | 
|---|
 | 2223 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 2224 |     { return BZ_MATHFN_SCOPE(sqrt)((float)x); }
 | 
|---|
 | 2225 | 
 | 
|---|
 | 2226 |     template<class T1>
 | 
|---|
 | 2227 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2228 |         const T1& a)
 | 
|---|
 | 2229 |     {
 | 
|---|
 | 2230 |         str += "sqrt(";
 | 
|---|
 | 2231 |         a.prettyPrint(str,format);
 | 
|---|
 | 2232 |         str += ")";
 | 
|---|
 | 2233 |     }
 | 
|---|
 | 2234 | };
 | 
|---|
 | 2235 | 
 | 
|---|
 | 2236 | // sqrt(long double)
 | 
|---|
 | 2237 | template<>
 | 
|---|
 | 2238 | class _bz_sqrt<long double> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2239 | public:
 | 
|---|
 | 2240 |     typedef long double T_numtype1;
 | 
|---|
 | 2241 |     typedef long double T_numtype;
 | 
|---|
 | 2242 | 
 | 
|---|
 | 2243 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 2244 |     { return BZ_MATHFN_SCOPE(sqrt)((long double)x); }
 | 
|---|
 | 2245 | 
 | 
|---|
 | 2246 |     template<class T1>
 | 
|---|
 | 2247 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2248 |         const T1& a)
 | 
|---|
 | 2249 |     {
 | 
|---|
 | 2250 |         str += "sqrt(";
 | 
|---|
 | 2251 |         a.prettyPrint(str,format);
 | 
|---|
 | 2252 |         str += ")";
 | 
|---|
 | 2253 |     }
 | 
|---|
 | 2254 | };
 | 
|---|
 | 2255 | 
 | 
|---|
 | 2256 | // sqrt(complex<float> )
 | 
|---|
 | 2257 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 2258 | template<>
 | 
|---|
 | 2259 | class _bz_sqrt<complex<float> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2260 | public:
 | 
|---|
 | 2261 |     typedef complex<float>  T_numtype1;
 | 
|---|
 | 2262 |     typedef complex<float> T_numtype;
 | 
|---|
 | 2263 | 
 | 
|---|
 | 2264 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 2265 |     { return BZ_CMATHFN_SCOPE(sqrt)((complex<float> )x); }
 | 
|---|
 | 2266 | 
 | 
|---|
 | 2267 |     template<class T1>
 | 
|---|
 | 2268 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2269 |         const T1& a)
 | 
|---|
 | 2270 |     {
 | 
|---|
 | 2271 |         str += "sqrt(";
 | 
|---|
 | 2272 |         a.prettyPrint(str,format);
 | 
|---|
 | 2273 |         str += ")";
 | 
|---|
 | 2274 |     }
 | 
|---|
 | 2275 | };
 | 
|---|
 | 2276 | #endif
 | 
|---|
 | 2277 | 
 | 
|---|
 | 2278 | // sqrt(complex<double> )
 | 
|---|
 | 2279 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 2280 | template<>
 | 
|---|
 | 2281 | class _bz_sqrt<complex<double> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2282 | public:
 | 
|---|
 | 2283 |     typedef complex<double>  T_numtype1;
 | 
|---|
 | 2284 |     typedef complex<double> T_numtype;
 | 
|---|
 | 2285 | 
 | 
|---|
 | 2286 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 2287 |     { return BZ_CMATHFN_SCOPE(sqrt)((complex<double> )x); }
 | 
|---|
 | 2288 | 
 | 
|---|
 | 2289 |     template<class T1>
 | 
|---|
 | 2290 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2291 |         const T1& a)
 | 
|---|
 | 2292 |     {
 | 
|---|
 | 2293 |         str += "sqrt(";
 | 
|---|
 | 2294 |         a.prettyPrint(str,format);
 | 
|---|
 | 2295 |         str += ")";
 | 
|---|
 | 2296 |     }
 | 
|---|
 | 2297 | };
 | 
|---|
 | 2298 | #endif
 | 
|---|
 | 2299 | 
 | 
|---|
 | 2300 | // sqrt(complex<long double> )
 | 
|---|
 | 2301 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 2302 | template<>
 | 
|---|
 | 2303 | class _bz_sqrt<complex<long double> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2304 | public:
 | 
|---|
 | 2305 |     typedef complex<long double>  T_numtype1;
 | 
|---|
 | 2306 |     typedef complex<long double> T_numtype;
 | 
|---|
 | 2307 | 
 | 
|---|
 | 2308 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 2309 |     { return BZ_CMATHFN_SCOPE(sqrt)((complex<long double> )x); }
 | 
|---|
 | 2310 | 
 | 
|---|
 | 2311 |     template<class T1>
 | 
|---|
 | 2312 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2313 |         const T1& a)
 | 
|---|
 | 2314 |     {
 | 
|---|
 | 2315 |         str += "sqrt(";
 | 
|---|
 | 2316 |         a.prettyPrint(str,format);
 | 
|---|
 | 2317 |         str += ")";
 | 
|---|
 | 2318 |     }
 | 
|---|
 | 2319 | };
 | 
|---|
 | 2320 | #endif
 | 
|---|
 | 2321 | 
 | 
|---|
 | 2322 | // tan(P_numtype1)    Tangent
 | 
|---|
 | 2323 | template<class P_numtype1>
 | 
|---|
 | 2324 | class _bz_tan : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2325 | public:
 | 
|---|
 | 2326 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 2327 |     typedef double T_numtype;
 | 
|---|
 | 2328 | 
 | 
|---|
 | 2329 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 2330 |     { return BZ_MATHFN_SCOPE(tan)((double)x); }
 | 
|---|
 | 2331 | 
 | 
|---|
 | 2332 |     template<class T1>
 | 
|---|
 | 2333 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2334 |         const T1& a)
 | 
|---|
 | 2335 |     {
 | 
|---|
 | 2336 |         str += "tan(";
 | 
|---|
 | 2337 |         a.prettyPrint(str,format);
 | 
|---|
 | 2338 |         str += ")";
 | 
|---|
 | 2339 |     }
 | 
|---|
 | 2340 | };
 | 
|---|
 | 2341 | 
 | 
|---|
 | 2342 | // tan(float)
 | 
|---|
 | 2343 | template<>
 | 
|---|
 | 2344 | class _bz_tan<float> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2345 | public:
 | 
|---|
 | 2346 |     typedef float T_numtype1;
 | 
|---|
 | 2347 |     typedef float T_numtype;
 | 
|---|
 | 2348 | 
 | 
|---|
 | 2349 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 2350 |     { return BZ_MATHFN_SCOPE(tan)((float)x); }
 | 
|---|
 | 2351 | 
 | 
|---|
 | 2352 |     template<class T1>
 | 
|---|
 | 2353 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2354 |         const T1& a)
 | 
|---|
 | 2355 |     {
 | 
|---|
 | 2356 |         str += "tan(";
 | 
|---|
 | 2357 |         a.prettyPrint(str,format);
 | 
|---|
 | 2358 |         str += ")";
 | 
|---|
 | 2359 |     }
 | 
|---|
 | 2360 | };
 | 
|---|
 | 2361 | 
 | 
|---|
 | 2362 | // tan(long double)
 | 
|---|
 | 2363 | template<>
 | 
|---|
 | 2364 | class _bz_tan<long double> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2365 | public:
 | 
|---|
 | 2366 |     typedef long double T_numtype1;
 | 
|---|
 | 2367 |     typedef long double T_numtype;
 | 
|---|
 | 2368 | 
 | 
|---|
 | 2369 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 2370 |     { return BZ_MATHFN_SCOPE(tan)((long double)x); }
 | 
|---|
 | 2371 | 
 | 
|---|
 | 2372 |     template<class T1>
 | 
|---|
 | 2373 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2374 |         const T1& a)
 | 
|---|
 | 2375 |     {
 | 
|---|
 | 2376 |         str += "tan(";
 | 
|---|
 | 2377 |         a.prettyPrint(str,format);
 | 
|---|
 | 2378 |         str += ")";
 | 
|---|
 | 2379 |     }
 | 
|---|
 | 2380 | };
 | 
|---|
 | 2381 | 
 | 
|---|
 | 2382 | // tan(complex<float> )
 | 
|---|
 | 2383 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 2384 | template<>
 | 
|---|
 | 2385 | class _bz_tan<complex<float> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2386 | public:
 | 
|---|
 | 2387 |     typedef complex<float>  T_numtype1;
 | 
|---|
 | 2388 |     typedef complex<float> T_numtype;
 | 
|---|
 | 2389 | 
 | 
|---|
 | 2390 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 2391 |     { return BZ_CMATHFN_SCOPE(tan)((complex<float> )x); }
 | 
|---|
 | 2392 | 
 | 
|---|
 | 2393 |     template<class T1>
 | 
|---|
 | 2394 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2395 |         const T1& a)
 | 
|---|
 | 2396 |     {
 | 
|---|
 | 2397 |         str += "tan(";
 | 
|---|
 | 2398 |         a.prettyPrint(str,format);
 | 
|---|
 | 2399 |         str += ")";
 | 
|---|
 | 2400 |     }
 | 
|---|
 | 2401 | };
 | 
|---|
 | 2402 | #endif
 | 
|---|
 | 2403 | 
 | 
|---|
 | 2404 | // tan(complex<double> )
 | 
|---|
 | 2405 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 2406 | template<>
 | 
|---|
 | 2407 | class _bz_tan<complex<double> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2408 | public:
 | 
|---|
 | 2409 |     typedef complex<double>  T_numtype1;
 | 
|---|
 | 2410 |     typedef complex<double> T_numtype;
 | 
|---|
 | 2411 | 
 | 
|---|
 | 2412 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 2413 |     { return BZ_CMATHFN_SCOPE(tan)((complex<double> )x); }
 | 
|---|
 | 2414 | 
 | 
|---|
 | 2415 |     template<class T1>
 | 
|---|
 | 2416 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2417 |         const T1& a)
 | 
|---|
 | 2418 |     {
 | 
|---|
 | 2419 |         str += "tan(";
 | 
|---|
 | 2420 |         a.prettyPrint(str,format);
 | 
|---|
 | 2421 |         str += ")";
 | 
|---|
 | 2422 |     }
 | 
|---|
 | 2423 | };
 | 
|---|
 | 2424 | #endif
 | 
|---|
 | 2425 | 
 | 
|---|
 | 2426 | // tan(complex<long double> )
 | 
|---|
 | 2427 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 2428 | template<>
 | 
|---|
 | 2429 | class _bz_tan<complex<long double> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2430 | public:
 | 
|---|
 | 2431 |     typedef complex<long double>  T_numtype1;
 | 
|---|
 | 2432 |     typedef complex<long double> T_numtype;
 | 
|---|
 | 2433 | 
 | 
|---|
 | 2434 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 2435 |     { return BZ_CMATHFN_SCOPE(tan)((complex<long double> )x); }
 | 
|---|
 | 2436 | 
 | 
|---|
 | 2437 |     template<class T1>
 | 
|---|
 | 2438 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2439 |         const T1& a)
 | 
|---|
 | 2440 |     {
 | 
|---|
 | 2441 |         str += "tan(";
 | 
|---|
 | 2442 |         a.prettyPrint(str,format);
 | 
|---|
 | 2443 |         str += ")";
 | 
|---|
 | 2444 |     }
 | 
|---|
 | 2445 | };
 | 
|---|
 | 2446 | #endif
 | 
|---|
 | 2447 | 
 | 
|---|
 | 2448 | // tanh(P_numtype1)    Hyperbolic tangent
 | 
|---|
 | 2449 | template<class P_numtype1>
 | 
|---|
 | 2450 | class _bz_tanh : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2451 | public:
 | 
|---|
 | 2452 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 2453 |     typedef double T_numtype;
 | 
|---|
 | 2454 | 
 | 
|---|
 | 2455 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 2456 |     { return BZ_MATHFN_SCOPE(tanh)((double)x); }
 | 
|---|
 | 2457 | 
 | 
|---|
 | 2458 |     template<class T1>
 | 
|---|
 | 2459 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2460 |         const T1& a)
 | 
|---|
 | 2461 |     {
 | 
|---|
 | 2462 |         str += "tanh(";
 | 
|---|
 | 2463 |         a.prettyPrint(str,format);
 | 
|---|
 | 2464 |         str += ")";
 | 
|---|
 | 2465 |     }
 | 
|---|
 | 2466 | };
 | 
|---|
 | 2467 | 
 | 
|---|
 | 2468 | // tanh(float)
 | 
|---|
 | 2469 | template<>
 | 
|---|
 | 2470 | class _bz_tanh<float> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2471 | public:
 | 
|---|
 | 2472 |     typedef float T_numtype1;
 | 
|---|
 | 2473 |     typedef float T_numtype;
 | 
|---|
 | 2474 | 
 | 
|---|
 | 2475 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 2476 |     { return BZ_MATHFN_SCOPE(tanh)((float)x); }
 | 
|---|
 | 2477 | 
 | 
|---|
 | 2478 |     template<class T1>
 | 
|---|
 | 2479 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2480 |         const T1& a)
 | 
|---|
 | 2481 |     {
 | 
|---|
 | 2482 |         str += "tanh(";
 | 
|---|
 | 2483 |         a.prettyPrint(str,format);
 | 
|---|
 | 2484 |         str += ")";
 | 
|---|
 | 2485 |     }
 | 
|---|
 | 2486 | };
 | 
|---|
 | 2487 | 
 | 
|---|
 | 2488 | // tanh(long double)
 | 
|---|
 | 2489 | template<>
 | 
|---|
 | 2490 | class _bz_tanh<long double> : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2491 | public:
 | 
|---|
 | 2492 |     typedef long double T_numtype1;
 | 
|---|
 | 2493 |     typedef long double T_numtype;
 | 
|---|
 | 2494 | 
 | 
|---|
 | 2495 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 2496 |     { return BZ_MATHFN_SCOPE(tanh)((long double)x); }
 | 
|---|
 | 2497 | 
 | 
|---|
 | 2498 |     template<class T1>
 | 
|---|
 | 2499 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2500 |         const T1& a)
 | 
|---|
 | 2501 |     {
 | 
|---|
 | 2502 |         str += "tanh(";
 | 
|---|
 | 2503 |         a.prettyPrint(str,format);
 | 
|---|
 | 2504 |         str += ")";
 | 
|---|
 | 2505 |     }
 | 
|---|
 | 2506 | };
 | 
|---|
 | 2507 | 
 | 
|---|
 | 2508 | // tanh(complex<float> )
 | 
|---|
 | 2509 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 2510 | template<>
 | 
|---|
 | 2511 | class _bz_tanh<complex<float> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2512 | public:
 | 
|---|
 | 2513 |     typedef complex<float>  T_numtype1;
 | 
|---|
 | 2514 |     typedef complex<float> T_numtype;
 | 
|---|
 | 2515 | 
 | 
|---|
 | 2516 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 2517 |     { return BZ_CMATHFN_SCOPE(tanh)((complex<float> )x); }
 | 
|---|
 | 2518 | 
 | 
|---|
 | 2519 |     template<class T1>
 | 
|---|
 | 2520 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2521 |         const T1& a)
 | 
|---|
 | 2522 |     {
 | 
|---|
 | 2523 |         str += "tanh(";
 | 
|---|
 | 2524 |         a.prettyPrint(str,format);
 | 
|---|
 | 2525 |         str += ")";
 | 
|---|
 | 2526 |     }
 | 
|---|
 | 2527 | };
 | 
|---|
 | 2528 | #endif
 | 
|---|
 | 2529 | 
 | 
|---|
 | 2530 | // tanh(complex<double> )
 | 
|---|
 | 2531 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 2532 | template<>
 | 
|---|
 | 2533 | class _bz_tanh<complex<double> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2534 | public:
 | 
|---|
 | 2535 |     typedef complex<double>  T_numtype1;
 | 
|---|
 | 2536 |     typedef complex<double> T_numtype;
 | 
|---|
 | 2537 | 
 | 
|---|
 | 2538 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 2539 |     { return BZ_CMATHFN_SCOPE(tanh)((complex<double> )x); }
 | 
|---|
 | 2540 | 
 | 
|---|
 | 2541 |     template<class T1>
 | 
|---|
 | 2542 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2543 |         const T1& a)
 | 
|---|
 | 2544 |     {
 | 
|---|
 | 2545 |         str += "tanh(";
 | 
|---|
 | 2546 |         a.prettyPrint(str,format);
 | 
|---|
 | 2547 |         str += ")";
 | 
|---|
 | 2548 |     }
 | 
|---|
 | 2549 | };
 | 
|---|
 | 2550 | #endif
 | 
|---|
 | 2551 | 
 | 
|---|
 | 2552 | // tanh(complex<long double> )
 | 
|---|
 | 2553 | #ifdef BZ_HAVE_COMPLEX_MATH1
 | 
|---|
 | 2554 | template<>
 | 
|---|
 | 2555 | class _bz_tanh<complex<long double> > : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2556 | public:
 | 
|---|
 | 2557 |     typedef complex<long double>  T_numtype1;
 | 
|---|
 | 2558 |     typedef complex<long double> T_numtype;
 | 
|---|
 | 2559 | 
 | 
|---|
 | 2560 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 2561 |     { return BZ_CMATHFN_SCOPE(tanh)((complex<long double> )x); }
 | 
|---|
 | 2562 | 
 | 
|---|
 | 2563 |     template<class T1>
 | 
|---|
 | 2564 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2565 |         const T1& a)
 | 
|---|
 | 2566 |     {
 | 
|---|
 | 2567 |         str += "tanh(";
 | 
|---|
 | 2568 |         a.prettyPrint(str,format);
 | 
|---|
 | 2569 |         str += ")";
 | 
|---|
 | 2570 |     }
 | 
|---|
 | 2571 | };
 | 
|---|
 | 2572 | #endif
 | 
|---|
 | 2573 | 
 | 
|---|
 | 2574 | // trunc(P_numtype1)    Nearest floating integer in the direction of zero
 | 
|---|
 | 2575 | #ifdef BZ_HAVE_IEEE_MATH
 | 
|---|
 | 2576 | template<class P_numtype1>
 | 
|---|
 | 2577 | class _bz_trunc : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2578 | public:
 | 
|---|
 | 2579 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 2580 |     typedef double T_numtype;
 | 
|---|
 | 2581 | 
 | 
|---|
 | 2582 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 2583 |     { return BZ_MATHFN_SCOPE(trunc)((double)x); }
 | 
|---|
 | 2584 | 
 | 
|---|
 | 2585 |     template<class T1>
 | 
|---|
 | 2586 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2587 |         const T1& a)
 | 
|---|
 | 2588 |     {
 | 
|---|
 | 2589 |         str += "trunc(";
 | 
|---|
 | 2590 |         a.prettyPrint(str,format);
 | 
|---|
 | 2591 |         str += ")";
 | 
|---|
 | 2592 |     }
 | 
|---|
 | 2593 | };
 | 
|---|
 | 2594 | #endif
 | 
|---|
 | 2595 | 
 | 
|---|
 | 2596 | // uitrunc(P_numtype1)    Truncate and convert to unsigned
 | 
|---|
 | 2597 | #ifdef BZ_HAVE_SYSTEM_V_MATH
 | 
|---|
 | 2598 | template<class P_numtype1>
 | 
|---|
 | 2599 | class _bz_uitrunc : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2600 | public:
 | 
|---|
 | 2601 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 2602 |     typedef unsigned T_numtype;
 | 
|---|
 | 2603 | 
 | 
|---|
 | 2604 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 2605 |     { return BZ_MATHFN_SCOPE(uitrunc)((unsigned)x); }
 | 
|---|
 | 2606 | 
 | 
|---|
 | 2607 |     template<class T1>
 | 
|---|
 | 2608 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2609 |         const T1& a)
 | 
|---|
 | 2610 |     {
 | 
|---|
 | 2611 |         str += "uitrunc(";
 | 
|---|
 | 2612 |         a.prettyPrint(str,format);
 | 
|---|
 | 2613 |         str += ")";
 | 
|---|
 | 2614 |     }
 | 
|---|
 | 2615 | };
 | 
|---|
 | 2616 | #endif
 | 
|---|
 | 2617 | 
 | 
|---|
 | 2618 | // unordered(P_numtype1, P_numtype2)    True if a comparison of x and y would be unordered
 | 
|---|
 | 2619 | #ifdef BZ_HAVE_SYSTEM_V_MATH
 | 
|---|
 | 2620 | template<class P_numtype1, class P_numtype2>
 | 
|---|
 | 2621 | class _bz_unordered : public TwoOperandApplicativeTemplatesBase {
 | 
|---|
 | 2622 | public:
 | 
|---|
 | 2623 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 2624 |     typedef P_numtype2 T_numtype2;
 | 
|---|
 | 2625 |     typedef int T_numtype;
 | 
|---|
 | 2626 | 
 | 
|---|
 | 2627 |     static inline T_numtype apply(T_numtype1 x, T_numtype2 y)
 | 
|---|
 | 2628 |     { return BZ_MATHFN_SCOPE(unordered)(x,y); }
 | 
|---|
 | 2629 | };
 | 
|---|
 | 2630 | #endif
 | 
|---|
 | 2631 | 
 | 
|---|
 | 2632 | // y0(P_numtype1)    Bessel function of the second kind, order zero
 | 
|---|
 | 2633 | #ifdef BZ_HAVE_IEEE_MATH
 | 
|---|
 | 2634 | template<class P_numtype1>
 | 
|---|
 | 2635 | class _bz_y0 : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2636 | public:
 | 
|---|
 | 2637 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 2638 |     typedef double T_numtype;
 | 
|---|
 | 2639 | 
 | 
|---|
 | 2640 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 2641 |     { return BZ_MATHFN_SCOPE(y0)((double)x); }
 | 
|---|
 | 2642 | 
 | 
|---|
 | 2643 |     template<class T1>
 | 
|---|
 | 2644 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2645 |         const T1& a)
 | 
|---|
 | 2646 |     {
 | 
|---|
 | 2647 |         str += "y0(";
 | 
|---|
 | 2648 |         a.prettyPrint(str,format);
 | 
|---|
 | 2649 |         str += ")";
 | 
|---|
 | 2650 |     }
 | 
|---|
 | 2651 | };
 | 
|---|
 | 2652 | #endif
 | 
|---|
 | 2653 | 
 | 
|---|
 | 2654 | // y1(P_numtype1)    Bessel function of the second kind, order one
 | 
|---|
 | 2655 | #ifdef BZ_HAVE_IEEE_MATH
 | 
|---|
 | 2656 | template<class P_numtype1>
 | 
|---|
 | 2657 | class _bz_y1 : public OneOperandApplicativeTemplatesBase {
 | 
|---|
 | 2658 | public:
 | 
|---|
 | 2659 |     typedef P_numtype1 T_numtype1;
 | 
|---|
 | 2660 |     typedef double T_numtype;
 | 
|---|
 | 2661 | 
 | 
|---|
 | 2662 |     static inline T_numtype apply(T_numtype1 x)
 | 
|---|
 | 2663 |     { return BZ_MATHFN_SCOPE(y1)((double)x); }
 | 
|---|
 | 2664 | 
 | 
|---|
 | 2665 |     template<class T1>
 | 
|---|
 | 2666 |     static void prettyPrint(string& str, prettyPrintFormat& format,
 | 
|---|
 | 2667 |         const T1& a)
 | 
|---|
 | 2668 |     {
 | 
|---|
 | 2669 |         str += "y1(";
 | 
|---|
 | 2670 |         a.prettyPrint(str,format);
 | 
|---|
 | 2671 |         str += ")";
 | 
|---|
 | 2672 |     }
 | 
|---|
 | 2673 | };
 | 
|---|
 | 2674 | #endif
 | 
|---|
 | 2675 | 
 | 
|---|
 | 2676 | 
 | 
|---|
 | 2677 | 
 | 
|---|
 | 2678 | BZ_NAMESPACE_END
 | 
|---|
 | 2679 | 
 | 
|---|
 | 2680 | #endif // BZ_MATHFUNC_H
 | 
|---|