source: XMLIO_V2/external/include/blitz/mathfunc.h @ 73

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