3 * Silicon Graphics Computer Systems, Inc.
8 * This material is provided "as is", with absolutely no warranty expressed
9 * or implied. Any use is at your own risk.
11 * Permission to use or copy this software for any purpose is hereby granted
12 * without fee, provided the above notices are retained on all copies.
13 * Permission to modify the code and to distribute modified code is granted,
14 * provided the above notices are retained, and a notice that the code was
15 * modified is included with the above copyright notice.
18 #ifndef _STLP_INTERNAL_COMPLEX
19 #define _STLP_INTERNAL_COMPLEX
21 // This header declares the template class complex, as described in
22 // in the draft C++ standard. Single-precision complex numbers
23 // are complex<float>, double-precision are complex<double>, and
24 // quad precision are complex<long double>.
26 // Note that the template class complex is declared within namespace
27 // std, as called for by the draft C++ standard.
29 #ifndef _STLP_INTERNAL_CMATH
30 # include <stl/_cmath.h>
35 #if !defined (_STLP_NO_COMPLEX_SPECIALIZATIONS) //*TY 02/25/2000 - added for MPW compiler workaround
37 template <class _Tp> struct complex;
39 _STLP_TEMPLATE_NULL struct _STLP_CLASS_DECLSPEC complex<float>;
40 _STLP_TEMPLATE_NULL struct _STLP_CLASS_DECLSPEC complex<double>;
41 # if !defined (_STLP_NO_LONG_DOUBLE)
42 _STLP_TEMPLATE_NULL struct _STLP_CLASS_DECLSPEC complex<long double>;
44 #endif /* _STLP_NO_COMPLEX_SPECIALIZATIONS */
48 typedef _Tp value_type;
49 typedef complex<_Tp> _Self;
51 // Constructors, destructor, assignment operator.
52 complex() : _M_re(0), _M_im(0) {}
53 complex(const value_type& __x)
54 : _M_re(__x), _M_im(0) {}
55 complex(const value_type& __x, const value_type& __y)
56 : _M_re(__x), _M_im(__y) {}
57 complex(const _Self& __z)
58 : _M_re(__z._M_re), _M_im(__z._M_im) {}
60 _Self& operator=(const _Self& __z) {
66 #if defined (_STLP_MEMBER_TEMPLATES) && (defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) || defined(_STLP_NO_COMPLEX_SPECIALIZATIONS))
68 explicit complex(const complex<_Tp2>& __z)
69 : _M_re(__z._M_re), _M_im(__z._M_im) {}
72 _Self& operator=(const complex<_Tp2>& __z) {
77 #endif /* _STLP_MEMBER_TEMPLATES */
80 value_type real() const { return _M_re; }
81 value_type imag() const { return _M_im; }
83 // Arithmetic op= operations involving one real argument.
85 _Self& operator= (const value_type& __x) {
90 _Self& operator+= (const value_type& __x) {
94 _Self& operator-= (const value_type& __x) {
98 _Self& operator*= (const value_type& __x) {
103 _Self& operator/= (const value_type& __x) {
109 // Arithmetic op= operations involving two complex arguments.
111 static void _STLP_CALL _div(const value_type& __z1_r, const value_type& __z1_i,
112 const value_type& __z2_r, const value_type& __z2_i,
113 value_type& __res_r, value_type& __res_i);
115 static void _STLP_CALL _div(const value_type& __z1_r,
116 const value_type& __z2_r, const value_type& __z2_i,
117 value_type& __res_r, value_type& __res_i);
119 #if defined (_STLP_MEMBER_TEMPLATES) // && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
121 template <class _Tp2> _Self& operator+= (const complex<_Tp2>& __z) {
127 template <class _Tp2> _Self& operator-= (const complex<_Tp2>& __z) {
133 template <class _Tp2> _Self& operator*= (const complex<_Tp2>& __z) {
134 value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
135 value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
141 template <class _Tp2> _Self& operator/= (const complex<_Tp2>& __z) {
144 _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
149 #endif /* _STLP_MEMBER_TEMPLATES */
151 _Self& operator+= (const _Self& __z) {
157 _Self& operator-= (const _Self& __z) {
163 _Self& operator*= (const _Self& __z) {
164 value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
165 value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
171 _Self& operator/= (const _Self& __z) {
174 _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
185 #if !defined (_STLP_NO_COMPLEX_SPECIALIZATIONS) //*TY 02/25/2000 - added for MPW compiler workaround
186 // Explicit specializations for float, double, long double. The only
187 // reason for these specializations is to enable automatic conversions
188 // from complex<float> to complex<double>, and complex<double> to
189 // complex<long double>.
192 struct _STLP_CLASS_DECLSPEC complex<float> {
193 typedef float value_type;
194 typedef complex<float> _Self;
195 // Constructors, destructor, assignment operator.
197 complex(value_type __x = 0.0f, value_type __y = 0.0f)
198 : _M_re(__x), _M_im(__y) {}
200 complex(const complex<float>& __z) : _M_re(__z._M_re), _M_im(__z._M_im) {}
202 inline explicit complex(const complex<double>& __z);
203 # ifndef _STLP_NO_LONG_DOUBLE
204 inline explicit complex(const complex<long double>& __z);
207 value_type real() const { return _M_re; }
208 value_type imag() const { return _M_im; }
210 // Arithmetic op= operations involving one real argument.
212 _Self& operator= (value_type __x) {
217 _Self& operator+= (value_type __x) {
221 _Self& operator-= (value_type __x) {
225 _Self& operator*= (value_type __x) {
230 _Self& operator/= (value_type __x) {
236 // Arithmetic op= operations involving two complex arguments.
238 static void _STLP_CALL _div(const float& __z1_r, const float& __z1_i,
239 const float& __z2_r, const float& __z2_i,
240 float& __res_r, float& __res_i);
242 static void _STLP_CALL _div(const float& __z1_r,
243 const float& __z2_r, const float& __z2_i,
244 float& __res_r, float& __res_i);
246 # if defined (_STLP_MEMBER_TEMPLATES)
247 template <class _Tp2>
248 complex<float>& operator=(const complex<_Tp2>& __z) {
254 template <class _Tp2>
255 complex<float>& operator+= (const complex<_Tp2>& __z) {
261 template <class _Tp2>
262 complex<float>& operator-= (const complex<_Tp2>& __z) {
268 template <class _Tp2>
269 complex<float>& operator*= (const complex<_Tp2>& __z) {
270 float __r = _M_re * __z._M_re - _M_im * __z._M_im;
271 float __i = _M_re * __z._M_im + _M_im * __z._M_re;
277 template <class _Tp2>
278 complex<float>& operator/= (const complex<_Tp2>& __z) {
281 _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
287 # endif /* _STLP_MEMBER_TEMPLATES */
289 _Self& operator=(const _Self& __z) {
295 _Self& operator+= (const _Self& __z) {
301 _Self& operator-= (const _Self& __z) {
307 _Self& operator*= (const _Self& __z) {
308 value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
309 value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
315 _Self& operator/= (const _Self& __z) {
318 _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
330 struct _STLP_CLASS_DECLSPEC complex<double> {
331 typedef double value_type;
332 typedef complex<double> _Self;
334 // Constructors, destructor, assignment operator.
336 complex(value_type __x = 0.0, value_type __y = 0.0)
337 : _M_re(__x), _M_im(__y) {}
339 complex(const complex<double>& __z)
340 : _M_re(__z._M_re), _M_im(__z._M_im) {}
341 inline complex(const complex<float>& __z);
342 # if !defined (_STLP_NO_LONG_DOUBLE)
343 explicit inline complex(const complex<long double>& __z);
346 value_type real() const { return _M_re; }
347 value_type imag() const { return _M_im; }
349 // Arithmetic op= operations involving one real argument.
351 _Self& operator= (value_type __x) {
356 _Self& operator+= (value_type __x) {
360 _Self& operator-= (value_type __x) {
364 _Self& operator*= (value_type __x) {
369 _Self& operator/= (value_type __x) {
375 // Arithmetic op= operations involving two complex arguments.
377 static void _STLP_CALL _div(const double& __z1_r, const double& __z1_i,
378 const double& __z2_r, const double& __z2_i,
379 double& __res_r, double& __res_i);
380 static void _STLP_CALL _div(const double& __z1_r,
381 const double& __z2_r, const double& __z2_i,
382 double& __res_r, double& __res_i);
384 # if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
385 template <class _Tp2>
386 complex<double>& operator=(const complex<_Tp2>& __z) {
392 template <class _Tp2>
393 complex<double>& operator+= (const complex<_Tp2>& __z) {
399 template <class _Tp2>
400 complex<double>& operator-= (const complex<_Tp2>& __z) {
406 template <class _Tp2>
407 complex<double>& operator*= (const complex<_Tp2>& __z) {
408 double __r = _M_re * __z._M_re - _M_im * __z._M_im;
409 double __i = _M_re * __z._M_im + _M_im * __z._M_re;
415 template <class _Tp2>
416 complex<double>& operator/= (const complex<_Tp2>& __z) {
419 _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
425 # endif /* _STLP_MEMBER_TEMPLATES */
427 _Self& operator=(const _Self& __z) {
433 _Self& operator+= (const _Self& __z) {
439 _Self& operator-= (const _Self& __z) {
445 _Self& operator*= (const _Self& __z) {
446 value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
447 value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
453 _Self& operator/= (const _Self& __z) {
456 _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
467 # if !defined (_STLP_NO_LONG_DOUBLE)
470 struct _STLP_CLASS_DECLSPEC complex<long double> {
471 typedef long double value_type;
472 typedef complex<long double> _Self;
474 // Constructors, destructor, assignment operator.
475 complex(value_type __x = 0.0l, value_type __y = 0.0l)
476 : _M_re(__x), _M_im(__y) {}
478 complex(const complex<long double>& __z)
479 : _M_re(__z._M_re), _M_im(__z._M_im) {}
480 inline complex(const complex<float>& __z);
481 inline complex(const complex<double>& __z);
484 value_type real() const { return _M_re; }
485 value_type imag() const { return _M_im; }
487 // Arithmetic op= operations involving one real argument.
489 _Self& operator= (value_type __x) {
494 _Self& operator+= (value_type __x) {
498 _Self& operator-= (value_type __x) {
502 _Self& operator*= (value_type __x) {
507 _Self& operator/= (value_type __x) {
513 // Arithmetic op= operations involving two complex arguments.
515 static void _STLP_CALL _div(const long double& __z1_r, const long double& __z1_i,
516 const long double& __z2_r, const long double& __z2_i,
517 long double& __res_r, long double& __res_i);
519 static void _STLP_CALL _div(const long double& __z1_r,
520 const long double& __z2_r, const long double& __z2_i,
521 long double& __res_r, long double& __res_i);
523 # if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
525 template <class _Tp2>
526 complex<long double>& operator=(const complex<_Tp2>& __z) {
532 template <class _Tp2>
533 complex<long double>& operator+= (const complex<_Tp2>& __z) {
539 template <class _Tp2>
540 complex<long double>& operator-= (const complex<_Tp2>& __z) {
546 template <class _Tp2>
547 complex<long double>& operator*= (const complex<_Tp2>& __z) {
548 long double __r = _M_re * __z._M_re - _M_im * __z._M_im;
549 long double __i = _M_re * __z._M_im + _M_im * __z._M_re;
555 template <class _Tp2>
556 complex<long double>& operator/= (const complex<_Tp2>& __z) {
559 _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
565 # endif /* _STLP_MEMBER_TEMPLATES */
567 _Self& operator=(const _Self& __z) {
573 _Self& operator+= (const _Self& __z) {
579 _Self& operator-= (const _Self& __z) {
585 _Self& operator*= (const _Self& __z) {
586 value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
587 value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
593 _Self& operator/= (const _Self& __z) {
596 _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
607 # endif /* _STLP_NO_LONG_DOUBLE */
609 // Converting constructors from one of these three specialized types
612 inline complex<float>::complex(const complex<double>& __z)
613 : _M_re((float)__z._M_re), _M_im((float)__z._M_im) {}
614 inline complex<double>::complex(const complex<float>& __z)
615 : _M_re(__z._M_re), _M_im(__z._M_im) {}
616 # ifndef _STLP_NO_LONG_DOUBLE
617 inline complex<float>::complex(const complex<long double>& __z)
618 : _M_re((float)__z._M_re), _M_im((float)__z._M_im) {}
619 inline complex<double>::complex(const complex<long double>& __z)
620 : _M_re((double)__z._M_re), _M_im((double)__z._M_im) {}
621 inline complex<long double>::complex(const complex<float>& __z)
622 : _M_re(__z._M_re), _M_im(__z._M_im) {}
623 inline complex<long double>::complex(const complex<double>& __z)
624 : _M_re(__z._M_re), _M_im(__z._M_im) {}
627 #endif /* SPECIALIZATIONS */
629 // Unary non-member arithmetic operators.
632 inline complex<_Tp> _STLP_CALL operator+(const complex<_Tp>& __z)
636 inline complex<_Tp> _STLP_CALL operator-(const complex<_Tp>& __z)
637 { return complex<_Tp>(-__z._M_re, -__z._M_im); }
639 // Non-member arithmetic operations involving one real argument.
642 inline complex<_Tp> _STLP_CALL operator+(const _Tp& __x, const complex<_Tp>& __z)
643 { return complex<_Tp>(__x + __z._M_re, __z._M_im); }
646 inline complex<_Tp> _STLP_CALL operator+(const complex<_Tp>& __z, const _Tp& __x)
647 { return complex<_Tp>(__z._M_re + __x, __z._M_im); }
650 inline complex<_Tp> _STLP_CALL operator-(const _Tp& __x, const complex<_Tp>& __z)
651 { return complex<_Tp>(__x - __z._M_re, -__z._M_im); }
654 inline complex<_Tp> _STLP_CALL operator-(const complex<_Tp>& __z, const _Tp& __x)
655 { return complex<_Tp>(__z._M_re - __x, __z._M_im); }
658 inline complex<_Tp> _STLP_CALL operator*(const _Tp& __x, const complex<_Tp>& __z)
659 { return complex<_Tp>(__x * __z._M_re, __x * __z._M_im); }
662 inline complex<_Tp> _STLP_CALL operator*(const complex<_Tp>& __z, const _Tp& __x)
663 { return complex<_Tp>(__z._M_re * __x, __z._M_im * __x); }
666 inline complex<_Tp> _STLP_CALL operator/(const _Tp& __x, const complex<_Tp>& __z) {
667 complex<_Tp> __result;
668 complex<_Tp>::_div(__x,
669 __z._M_re, __z._M_im,
670 __result._M_re, __result._M_im);
675 inline complex<_Tp> _STLP_CALL operator/(const complex<_Tp>& __z, const _Tp& __x)
676 { return complex<_Tp>(__z._M_re / __x, __z._M_im / __x); }
678 // Non-member arithmetic operations involving two complex arguments
681 inline complex<_Tp> _STLP_CALL
682 operator+(const complex<_Tp>& __z1, const complex<_Tp>& __z2)
683 { return complex<_Tp>(__z1._M_re + __z2._M_re, __z1._M_im + __z2._M_im); }
686 inline complex<_Tp> _STLP_CALL
687 operator-(const complex<_Tp>& __z1, const complex<_Tp>& __z2)
688 { return complex<_Tp>(__z1._M_re - __z2._M_re, __z1._M_im - __z2._M_im); }
691 inline complex<_Tp> _STLP_CALL
692 operator*(const complex<_Tp>& __z1, const complex<_Tp>& __z2) {
693 return complex<_Tp>(__z1._M_re * __z2._M_re - __z1._M_im * __z2._M_im,
694 __z1._M_re * __z2._M_im + __z1._M_im * __z2._M_re);
698 inline complex<_Tp> _STLP_CALL
699 operator/(const complex<_Tp>& __z1, const complex<_Tp>& __z2) {
700 complex<_Tp> __result;
701 complex<_Tp>::_div(__z1._M_re, __z1._M_im,
702 __z2._M_re, __z2._M_im,
703 __result._M_re, __result._M_im);
707 // Comparison operators.
710 inline bool _STLP_CALL operator==(const complex<_Tp>& __z1, const complex<_Tp>& __z2)
711 { return __z1._M_re == __z2._M_re && __z1._M_im == __z2._M_im; }
714 inline bool _STLP_CALL operator==(const complex<_Tp>& __z, const _Tp& __x)
715 { return __z._M_re == __x && __z._M_im == 0; }
718 inline bool _STLP_CALL operator==(const _Tp& __x, const complex<_Tp>& __z)
719 { return __x == __z._M_re && 0 == __z._M_im; }
721 //04/27/04 dums: removal of this check, if it is restablish
722 //please explain why the other operators are not macro guarded
723 //#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER
726 inline bool _STLP_CALL operator!=(const complex<_Tp>& __z1, const complex<_Tp>& __z2)
727 { return __z1._M_re != __z2._M_re || __z1._M_im != __z2._M_im; }
729 //#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */
732 inline bool _STLP_CALL operator!=(const complex<_Tp>& __z, const _Tp& __x)
733 { return __z._M_re != __x || __z._M_im != 0; }
736 inline bool _STLP_CALL operator!=(const _Tp& __x, const complex<_Tp>& __z)
737 { return __x != __z._M_re || 0 != __z._M_im; }
739 // Other basic arithmetic operations
741 inline _Tp _STLP_CALL real(const complex<_Tp>& __z)
742 { return __z._M_re; }
745 inline _Tp _STLP_CALL imag(const complex<_Tp>& __z)
746 { return __z._M_im; }
749 _Tp _STLP_CALL abs(const complex<_Tp>& __z);
752 _Tp _STLP_CALL arg(const complex<_Tp>& __z);
755 inline _Tp _STLP_CALL norm(const complex<_Tp>& __z)
756 { return __z._M_re * __z._M_re + __z._M_im * __z._M_im; }
759 inline complex<_Tp> _STLP_CALL conj(const complex<_Tp>& __z)
760 { return complex<_Tp>(__z._M_re, -__z._M_im); }
763 complex<_Tp> _STLP_CALL polar(const _Tp& __rho)
764 { return complex<_Tp>(__rho, 0); }
767 complex<_Tp> _STLP_CALL polar(const _Tp& __rho, const _Tp& __phi);
770 _STLP_DECLSPEC float _STLP_CALL abs(const complex<float>&);
772 _STLP_DECLSPEC double _STLP_CALL abs(const complex<double>&);
774 _STLP_DECLSPEC float _STLP_CALL arg(const complex<float>&);
776 _STLP_DECLSPEC double _STLP_CALL arg(const complex<double>&);
778 _STLP_DECLSPEC complex<float> _STLP_CALL polar(const float& __rho, const float& __phi);
780 _STLP_DECLSPEC complex<double> _STLP_CALL polar(const double& __rho, const double& __phi);
783 _Tp _STLP_CALL abs(const complex<_Tp>& __z)
784 { return _Tp(abs(complex<double>(double(__z.real()), double(__z.imag())))); }
787 _Tp _STLP_CALL arg(const complex<_Tp>& __z)
788 { return _Tp(arg(complex<double>(double(__z.real()), double(__z.imag())))); }
791 complex<_Tp> _STLP_CALL polar(const _Tp& __rho, const _Tp& __phi) {
792 complex<double> __tmp = polar(double(__rho), double(__phi));
793 return complex<_Tp>(_Tp(__tmp.real()), _Tp(__tmp.imag()));
796 #if !defined (_STLP_NO_LONG_DOUBLE)
798 _STLP_DECLSPEC long double _STLP_CALL arg(const complex<long double>&);
800 _STLP_DECLSPEC long double _STLP_CALL abs(const complex<long double>&);
802 _STLP_DECLSPEC complex<long double> _STLP_CALL polar(const long double&, const long double&);
806 #if !defined (_STLP_USE_NO_IOSTREAMS)
812 _STLP_BEGIN_NAMESPACE
814 // Complex output, in the form (re,im). We use a two-step process
815 // involving stringstream so that we get the padding right.
816 template <class _Tp, class _CharT, class _Traits>
817 basic_ostream<_CharT, _Traits>& _STLP_CALL
818 operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __z);
820 template <class _Tp, class _CharT, class _Traits>
821 basic_istream<_CharT, _Traits>& _STLP_CALL
822 operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __z);
824 // Specializations for narrow characters; lets us avoid widen.
826 _STLP_OPERATOR_TEMPLATE
827 _STLP_DECLSPEC basic_istream<char, char_traits<char> >& _STLP_CALL
828 operator>>(basic_istream<char, char_traits<char> >& __is, complex<float>& __z);
830 _STLP_OPERATOR_TEMPLATE
831 _STLP_DECLSPEC basic_istream<char, char_traits<char> >& _STLP_CALL
832 operator>>(basic_istream<char, char_traits<char> >& __is, complex<double>& __z);
834 _STLP_OPERATOR_TEMPLATE
835 _STLP_DECLSPEC basic_ostream<char, char_traits<char> >& _STLP_CALL
836 operator<<(basic_ostream<char, char_traits<char> >& __is, const complex<float>& __z);
838 _STLP_OPERATOR_TEMPLATE
839 _STLP_DECLSPEC basic_ostream<char, char_traits<char> >& _STLP_CALL
840 operator<<(basic_ostream<char, char_traits<char> >& __is, const complex<double>& __z);
842 # if !defined (_STLP_NO_LONG_DOUBLE)
843 _STLP_OPERATOR_TEMPLATE
844 _STLP_DECLSPEC basic_istream<char, char_traits<char> >& _STLP_CALL
845 operator>>(basic_istream<char, char_traits<char> >& __is, complex<long double>& __z);
847 _STLP_OPERATOR_TEMPLATE
848 _STLP_DECLSPEC basic_ostream<char, char_traits<char> >& _STLP_CALL
849 operator<<(basic_ostream<char, char_traits<char> >& __is, const complex<long double>& __z);
853 # if defined (_STLP_USE_TEMPLATE_EXPORT) && ! defined (_STLP_NO_WCHAR_T)
855 _STLP_EXPORT_TEMPLATE basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
856 operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<double>&);
857 _STLP_EXPORT_TEMPLATE basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
858 operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<double>&);
859 _STLP_EXPORT_TEMPLATE basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
860 operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<float>&);
861 _STLP_EXPORT_TEMPLATE basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
862 operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<float>&);
864 # if !defined (_STLP_NO_LONG_DOUBLE)
865 _STLP_EXPORT_TEMPLATE basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
866 operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<long double>&);
867 _STLP_EXPORT_TEMPLATE basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
868 operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<long double>&);
874 // Transcendental functions. These are defined only for float,
875 // double, and long double. (Sqrt isn't transcendental, of course,
876 // but it's included in this section anyway.)
878 _STLP_DECLSPEC complex<float> _STLP_CALL sqrt(const complex<float>&);
880 _STLP_DECLSPEC complex<float> _STLP_CALL exp(const complex<float>&);
881 _STLP_DECLSPEC complex<float> _STLP_CALL log(const complex<float>&);
882 _STLP_DECLSPEC complex<float> _STLP_CALL log10(const complex<float>&);
884 _STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>&, int);
885 _STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>&, const float&);
886 _STLP_DECLSPEC complex<float> _STLP_CALL pow(const float&, const complex<float>&);
887 _STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>&, const complex<float>&);
889 _STLP_DECLSPEC complex<float> _STLP_CALL sin(const complex<float>&);
890 _STLP_DECLSPEC complex<float> _STLP_CALL cos(const complex<float>&);
891 _STLP_DECLSPEC complex<float> _STLP_CALL tan(const complex<float>&);
893 _STLP_DECLSPEC complex<float> _STLP_CALL sinh(const complex<float>&);
894 _STLP_DECLSPEC complex<float> _STLP_CALL cosh(const complex<float>&);
895 _STLP_DECLSPEC complex<float> _STLP_CALL tanh(const complex<float>&);
897 _STLP_DECLSPEC complex<double> _STLP_CALL sqrt(const complex<double>&);
899 _STLP_DECLSPEC complex<double> _STLP_CALL exp(const complex<double>&);
900 _STLP_DECLSPEC complex<double> _STLP_CALL log(const complex<double>&);
901 _STLP_DECLSPEC complex<double> _STLP_CALL log10(const complex<double>&);
903 _STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>&, int);
904 _STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>&, const double&);
905 _STLP_DECLSPEC complex<double> _STLP_CALL pow(const double&, const complex<double>&);
906 _STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>&, const complex<double>&);
908 _STLP_DECLSPEC complex<double> _STLP_CALL sin(const complex<double>&);
909 _STLP_DECLSPEC complex<double> _STLP_CALL cos(const complex<double>&);
910 _STLP_DECLSPEC complex<double> _STLP_CALL tan(const complex<double>&);
912 _STLP_DECLSPEC complex<double> _STLP_CALL sinh(const complex<double>&);
913 _STLP_DECLSPEC complex<double> _STLP_CALL cosh(const complex<double>&);
914 _STLP_DECLSPEC complex<double> _STLP_CALL tanh(const complex<double>&);
916 #if !defined (_STLP_NO_LONG_DOUBLE)
917 _STLP_DECLSPEC complex<long double> _STLP_CALL sqrt(const complex<long double>&);
918 _STLP_DECLSPEC complex<long double> _STLP_CALL exp(const complex<long double>&);
919 _STLP_DECLSPEC complex<long double> _STLP_CALL log(const complex<long double>&);
920 _STLP_DECLSPEC complex<long double> _STLP_CALL log10(const complex<long double>&);
922 _STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>&, int);
923 _STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>&, const long double&);
924 _STLP_DECLSPEC complex<long double> _STLP_CALL pow(const long double&, const complex<long double>&);
925 _STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>&,
926 const complex<long double>&);
928 _STLP_DECLSPEC complex<long double> _STLP_CALL sin(const complex<long double>&);
929 _STLP_DECLSPEC complex<long double> _STLP_CALL cos(const complex<long double>&);
930 _STLP_DECLSPEC complex<long double> _STLP_CALL tan(const complex<long double>&);
932 _STLP_DECLSPEC complex<long double> _STLP_CALL sinh(const complex<long double>&);
933 _STLP_DECLSPEC complex<long double> _STLP_CALL cosh(const complex<long double>&);
934 _STLP_DECLSPEC complex<long double> _STLP_CALL tanh(const complex<long double>&);
939 #ifndef _STLP_LINK_TIME_INSTANTIATION
940 # include <stl/_complex.c>