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 complex<float>;
40 _STLP_TEMPLATE_NULL struct complex<double>;
41 # if !defined (_STLP_NO_LONG_DOUBLE)
42 _STLP_TEMPLATE_NULL struct 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 _STLP_DECLSPEC 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 _STLP_DECLSPEC 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 _STLP_DECLSPEC 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 _STLP_DECLSPEC 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 _STLP_DECLSPEC 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 _STLP_DECLSPEC 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; }
748 #if defined(__SYMBIAN32__) && defined (_STLP_DESIGNATED_DLL) && (__ARMCC_VERSION >= 220435 && __ARMCC_VERSION < 230000) //RVCT 2.2, __declspec(dllexport) should be there at declaration
750 _Tp _STLP_CALL _STLP_DECLSPEC abs(const complex<_Tp>& __z);
753 _Tp _STLP_CALL _STLP_DECLSPEC arg(const complex<_Tp>& __z);
756 _Tp _STLP_CALL abs(const complex<_Tp>& __z);
759 _Tp _STLP_CALL arg(const complex<_Tp>& __z);
760 #endif //__SYMBIAN32__ && _STLP_DESIGNATED_DLL
763 inline _Tp _STLP_CALL norm(const complex<_Tp>& __z)
764 { return __z._M_re * __z._M_re + __z._M_im * __z._M_im; }
767 inline complex<_Tp> _STLP_CALL conj(const complex<_Tp>& __z)
768 { return complex<_Tp>(__z._M_re, -__z._M_im); }
771 complex<_Tp> _STLP_CALL polar(const _Tp& __rho)
772 { return complex<_Tp>(__rho, 0); }
774 #if defined(__SYMBIAN32__) && defined (_STLP_DESIGNATED_DLL) && (__ARMCC_VERSION >= 220435 && __ARMCC_VERSION < 230000)
776 complex<_Tp> _STLP_CALL _STLP_DECLSPEC polar(const _Tp& __rho, const _Tp& __phi);
779 complex<_Tp> _STLP_CALL polar(const _Tp& __rho, const _Tp& __phi);
780 #endif //__SYMBIAN32__ && _STLP_DESIGNATED_DLL
784 _STLP_DECLSPEC float _STLP_CALL abs(const complex<float>&);
786 _STLP_DECLSPEC double _STLP_CALL abs(const complex<double>&);
788 _STLP_DECLSPEC float _STLP_CALL arg(const complex<float>&);
790 _STLP_DECLSPEC double _STLP_CALL arg(const complex<double>&);
792 _STLP_DECLSPEC complex<float> _STLP_CALL polar(const float& __rho, const float& __phi);
794 _STLP_DECLSPEC complex<double> _STLP_CALL polar(const double& __rho, const double& __phi);
797 _Tp _STLP_CALL abs(const complex<_Tp>& __z)
798 { return _Tp(abs(complex<double>(double(__z.real()), double(__z.imag())))); }
801 _Tp _STLP_CALL arg(const complex<_Tp>& __z)
802 { return _Tp(arg(complex<double>(double(__z.real()), double(__z.imag())))); }
805 complex<_Tp> _STLP_CALL polar(const _Tp& __rho, const _Tp& __phi) {
806 complex<double> __tmp = polar(double(__rho), double(__phi));
807 return complex<_Tp>(_Tp(__tmp.real()), _Tp(__tmp.imag()));
810 #if !defined (_STLP_NO_LONG_DOUBLE)
812 _STLP_DECLSPEC long double _STLP_CALL arg(const complex<long double>&);
814 _STLP_DECLSPEC long double _STLP_CALL abs(const complex<long double>&);
816 _STLP_DECLSPEC complex<long double> _STLP_CALL polar(const long double&, const long double&);
820 #if !defined (_STLP_USE_NO_IOSTREAMS)
826 _STLP_BEGIN_NAMESPACE
828 // Complex output, in the form (re,im). We use a two-step process
829 // involving stringstream so that we get the padding right.
830 template <class _Tp, class _CharT, class _Traits>
831 basic_ostream<_CharT, _Traits>& _STLP_CALL
832 operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __z);
834 template <class _Tp, class _CharT, class _Traits>
835 basic_istream<_CharT, _Traits>& _STLP_CALL
836 operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __z);
838 // Specializations for narrow characters; lets us avoid widen.
840 _STLP_OPERATOR_TEMPLATE
841 _STLP_DECLSPEC basic_istream<char, char_traits<char> >& _STLP_CALL
842 operator>>(basic_istream<char, char_traits<char> >& __is, complex<float>& __z);
844 _STLP_OPERATOR_TEMPLATE
845 _STLP_DECLSPEC basic_istream<char, char_traits<char> >& _STLP_CALL
846 operator>>(basic_istream<char, char_traits<char> >& __is, complex<double>& __z);
848 _STLP_OPERATOR_TEMPLATE
849 _STLP_DECLSPEC basic_ostream<char, char_traits<char> >& _STLP_CALL
850 operator<<(basic_ostream<char, char_traits<char> >& __is, const complex<float>& __z);
852 _STLP_OPERATOR_TEMPLATE
853 _STLP_DECLSPEC basic_ostream<char, char_traits<char> >& _STLP_CALL
854 operator<<(basic_ostream<char, char_traits<char> >& __is, const complex<double>& __z);
856 # if !defined (_STLP_NO_LONG_DOUBLE)
857 _STLP_OPERATOR_TEMPLATE
858 _STLP_DECLSPEC basic_istream<char, char_traits<char> >& _STLP_CALL
859 operator>>(basic_istream<char, char_traits<char> >& __is, complex<long double>& __z);
861 _STLP_OPERATOR_TEMPLATE
862 _STLP_DECLSPEC basic_ostream<char, char_traits<char> >& _STLP_CALL
863 operator<<(basic_ostream<char, char_traits<char> >& __is, const complex<long double>& __z);
867 # if defined (_STLP_USE_TEMPLATE_EXPORT) && ! defined (_STLP_NO_WCHAR_T)
869 _STLP_EXPORT_TEMPLATE basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
870 operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<double>&);
871 _STLP_EXPORT_TEMPLATE basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
872 operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<double>&);
873 _STLP_EXPORT_TEMPLATE basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
874 operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<float>&);
875 _STLP_EXPORT_TEMPLATE basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
876 operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<float>&);
878 # if !defined (_STLP_NO_LONG_DOUBLE)
879 _STLP_EXPORT_TEMPLATE basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
880 operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<long double>&);
881 _STLP_EXPORT_TEMPLATE basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
882 operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<long double>&);
888 // Transcendental functions. These are defined only for float,
889 // double, and long double. (Sqrt isn't transcendental, of course,
890 // but it's included in this section anyway.)
892 _STLP_DECLSPEC complex<float> _STLP_CALL sqrt(const complex<float>&);
894 _STLP_DECLSPEC complex<float> _STLP_CALL exp(const complex<float>&);
895 _STLP_DECLSPEC complex<float> _STLP_CALL log(const complex<float>&);
896 _STLP_DECLSPEC complex<float> _STLP_CALL log10(const complex<float>&);
898 _STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>&, int);
899 _STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>&, const float&);
900 _STLP_DECLSPEC complex<float> _STLP_CALL pow(const float&, const complex<float>&);
901 _STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>&, const complex<float>&);
903 _STLP_DECLSPEC complex<float> _STLP_CALL sin(const complex<float>&);
904 _STLP_DECLSPEC complex<float> _STLP_CALL cos(const complex<float>&);
905 _STLP_DECLSPEC complex<float> _STLP_CALL tan(const complex<float>&);
907 _STLP_DECLSPEC complex<float> _STLP_CALL sinh(const complex<float>&);
908 _STLP_DECLSPEC complex<float> _STLP_CALL cosh(const complex<float>&);
909 _STLP_DECLSPEC complex<float> _STLP_CALL tanh(const complex<float>&);
911 _STLP_DECLSPEC complex<double> _STLP_CALL sqrt(const complex<double>&);
913 _STLP_DECLSPEC complex<double> _STLP_CALL exp(const complex<double>&);
914 _STLP_DECLSPEC complex<double> _STLP_CALL log(const complex<double>&);
915 _STLP_DECLSPEC complex<double> _STLP_CALL log10(const complex<double>&);
917 _STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>&, int);
918 _STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>&, const double&);
919 _STLP_DECLSPEC complex<double> _STLP_CALL pow(const double&, const complex<double>&);
920 _STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>&, const complex<double>&);
922 _STLP_DECLSPEC complex<double> _STLP_CALL sin(const complex<double>&);
923 _STLP_DECLSPEC complex<double> _STLP_CALL cos(const complex<double>&);
924 _STLP_DECLSPEC complex<double> _STLP_CALL tan(const complex<double>&);
926 _STLP_DECLSPEC complex<double> _STLP_CALL sinh(const complex<double>&);
927 _STLP_DECLSPEC complex<double> _STLP_CALL cosh(const complex<double>&);
928 _STLP_DECLSPEC complex<double> _STLP_CALL tanh(const complex<double>&);
930 #if !defined (_STLP_NO_LONG_DOUBLE)
931 _STLP_DECLSPEC complex<long double> _STLP_CALL sqrt(const complex<long double>&);
932 _STLP_DECLSPEC complex<long double> _STLP_CALL exp(const complex<long double>&);
933 _STLP_DECLSPEC complex<long double> _STLP_CALL log(const complex<long double>&);
934 _STLP_DECLSPEC complex<long double> _STLP_CALL log10(const complex<long double>&);
936 _STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>&, int);
937 _STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>&, const long double&);
938 _STLP_DECLSPEC complex<long double> _STLP_CALL pow(const long double&, const complex<long double>&);
939 _STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>&,
940 const complex<long double>&);
942 _STLP_DECLSPEC complex<long double> _STLP_CALL sin(const complex<long double>&);
943 _STLP_DECLSPEC complex<long double> _STLP_CALL cos(const complex<long double>&);
944 _STLP_DECLSPEC complex<long double> _STLP_CALL tan(const complex<long double>&);
946 _STLP_DECLSPEC complex<long double> _STLP_CALL sinh(const complex<long double>&);
947 _STLP_DECLSPEC complex<long double> _STLP_CALL cosh(const complex<long double>&);
948 _STLP_DECLSPEC complex<long double> _STLP_CALL tanh(const complex<long double>&);
953 #ifndef _STLP_LINK_TIME_INSTANTIATION
954 # include <stl/_complex.c>