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_h
19 #define _STLP_internal_complex_h
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 #include <stl/_cmath.h>
34 #if !defined(_STLP_NO_COMPLEX_SPECIALIZATIONS) //*TY 02/25/2000 - added for MPW compiler workaround
36 template <class _Tp> struct complex;
38 _STLP_TEMPLATE_NULL struct _STLP_CLASS_DECLSPEC complex<float>;
39 _STLP_TEMPLATE_NULL struct _STLP_CLASS_DECLSPEC complex<double>;
40 # ifndef _STLP_NO_LONG_DOUBLE
41 _STLP_TEMPLATE_NULL struct _STLP_CLASS_DECLSPEC complex<long double>;
47 typedef _Tp value_type;
48 typedef complex<_Tp> _Self;
50 // Constructors, destructor, assignment operator.
51 complex() : _M_re(0), _M_im(0) {}
52 complex(const value_type& __x)
53 : _M_re(__x), _M_im(0) {}
54 complex(const value_type& __x, const value_type& __y)
55 : _M_re(__x), _M_im(__y) {}
56 complex(const _Self& __z)
57 : _M_re(__z._M_re), _M_im(__z._M_im) {}
59 _Self& operator=(const _Self& __z) {
65 #if defined (_STLP_MEMBER_TEMPLATES) && ( defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) || defined(_STLP_NO_COMPLEX_SPECIALIZATIONS))
67 explicit complex(const complex<_Tp2>& __z)
68 : _M_re(__z._M_re), _M_im(__z._M_im) {}
71 _Self& operator=(const complex<_Tp2>& __z) {
76 #endif /* _STLP_MEMBER_TEMPLATES */
79 value_type real() const { return _M_re; }
80 value_type imag() const { return _M_im; }
82 // Arithmetic op= operations involving one real argument.
84 _Self& operator= (const value_type& __x) {
89 _Self& operator+= (const value_type& __x) {
93 _Self& operator-= (const value_type& __x) {
97 _Self& operator*= (const value_type& __x) {
102 _Self& operator/= (const value_type& __x) {
108 // Arithmetic op= operations involving two complex arguments.
110 static void _STLP_CALL _div(const value_type& __z1_r, const value_type& __z1_i,
111 const value_type& __z2_r, const value_type& __z2_i,
112 value_type& __res_r, value_type& __res_i);
114 static void _STLP_CALL _div(const value_type& __z1_r,
115 const value_type& __z2_r, const value_type& __z2_i,
116 value_type& __res_r, value_type& __res_i);
118 #if defined ( _STLP_MEMBER_TEMPLATES ) // && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
120 template <class _Tp2> _Self& operator+= (const complex<_Tp2>& __z) {
126 template <class _Tp2> _Self& operator-= (const complex<_Tp2>& __z) {
132 template <class _Tp2> _Self& operator*= (const complex<_Tp2>& __z) {
133 value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
134 value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
140 template <class _Tp2> _Self& operator/= (const complex<_Tp2>& __z) {
143 _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>.
193 struct _STLP_CLASS_DECLSPEC complex<float> {
194 typedef float value_type;
195 typedef complex<float> _Self;
196 // Constructors, destructor, assignment operator.
198 complex(value_type __x = 0.0, value_type __y = 0.0)
199 : _M_re(__x), _M_im(__y) {}
201 complex(const complex<float>& __z) : _M_re(__z._M_re), _M_im(__z._M_im) {}
203 inline explicit complex(const complex<double>& __z);
204 # ifndef _STLP_NO_LONG_DOUBLE
205 inline explicit complex(const complex<long double>& __z);
208 value_type real() const { return _M_re; }
209 value_type imag() const { return _M_im; }
211 // Arithmetic op= operations involving one real argument.
213 _Self& operator= (value_type __x) {
218 _Self& operator+= (value_type __x) {
222 _Self& operator-= (value_type __x) {
226 _Self& operator*= (value_type __x) {
231 _Self& operator/= (value_type __x) {
237 // Arithmetic op= operations involving two complex arguments.
239 _STLP_DECLSPEC static void _STLP_CALL _div(const float& __z1_r, const float& __z1_i,
240 const float& __z2_r, const float& __z2_i,
241 float& __res_r, float& __res_i);
243 _STLP_DECLSPEC static void _STLP_CALL _div(const float& __z1_r,
244 const float& __z2_r, const float& __z2_i,
245 float& __res_r, float& __res_i);
247 #if defined (_STLP_MEMBER_TEMPLATES)
249 template <class _Tp2>
250 complex<float>& operator=(const complex<_Tp2>& __z) {
256 template <class _Tp2>
257 complex<float>& operator+= (const complex<_Tp2>& __z) {
263 template <class _Tp2>
264 complex<float>& operator-= (const complex<_Tp2>& __z) {
270 template <class _Tp2>
271 complex<float>& operator*= (const complex<_Tp2>& __z) {
272 float __r = _M_re * __z._M_re - _M_im * __z._M_im;
273 float __i = _M_re * __z._M_im + _M_im * __z._M_re;
279 template <class _Tp2>
280 complex<float>& operator/= (const complex<_Tp2>& __z) {
283 _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
289 #endif /* _STLP_MEMBER_TEMPLATES */
291 _Self& operator=(const _Self& __z) {
297 _Self& operator+= (const _Self& __z) {
303 _Self& operator-= (const _Self& __z) {
309 _Self& operator*= (const _Self& __z) {
310 value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
311 value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
317 _Self& operator/= (const _Self& __z) {
320 _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
331 _STLP_TEMPLATE_NULL struct _STLP_CLASS_DECLSPEC complex<double> {
332 typedef double value_type;
333 typedef complex<double> _Self;
335 // Constructors, destructor, assignment operator.
337 complex(value_type __x = 0.0, value_type __y = 0.0)
338 : _M_re(__x), _M_im(__y) {}
340 complex(const complex<double>& __z)
341 : _M_re(__z._M_re), _M_im(__z._M_im) {}
342 inline complex(const complex<float>& __z);
343 # ifndef _STLP_NO_LONG_DOUBLE
344 explicit inline complex(const complex<long double>& __z);
347 value_type real() const { return _M_re; }
348 value_type imag() const { return _M_im; }
350 // Arithmetic op= operations involving one real argument.
352 _Self& operator= (value_type __x) {
357 _Self& operator+= (value_type __x) {
361 _Self& operator-= (value_type __x) {
365 _Self& operator*= (value_type __x) {
370 _Self& operator/= (value_type __x) {
376 // Arithmetic op= operations involving two complex arguments.
378 _STLP_DECLSPEC static void _STLP_CALL _div(const double& __z1_r, const double& __z1_i,
379 const double& __z2_r, const double& __z2_i,
380 double& __res_r, double& __res_i);
381 _STLP_DECLSPEC static void _STLP_CALL _div(const double& __z1_r,
382 const double& __z2_r, const double& __z2_i,
383 double& __res_r, double& __res_i);
385 #if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
387 template <class _Tp2>
388 complex<double>& operator=(const complex<_Tp2>& __z) {
394 template <class _Tp2>
395 complex<double>& operator+= (const complex<_Tp2>& __z) {
401 template <class _Tp2>
402 complex<double>& operator-= (const complex<_Tp2>& __z) {
408 template <class _Tp2>
409 complex<double>& operator*= (const complex<_Tp2>& __z) {
410 double __r = _M_re * __z._M_re - _M_im * __z._M_im;
411 double __i = _M_re * __z._M_im + _M_im * __z._M_re;
417 template <class _Tp2>
418 complex<double>& operator/= (const complex<_Tp2>& __z) {
421 _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
427 #endif /* _STLP_MEMBER_TEMPLATES */
429 _Self& operator=(const _Self& __z) {
435 _Self& operator+= (const _Self& __z) {
441 _Self& operator-= (const _Self& __z) {
447 _Self& operator*= (const _Self& __z) {
448 value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
449 value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
455 _Self& operator/= (const _Self& __z) {
458 _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
469 # ifndef _STLP_NO_LONG_DOUBLE
471 _STLP_TEMPLATE_NULL struct _STLP_CLASS_DECLSPEC complex<long double> {
472 typedef long double value_type;
473 typedef complex<long double> _Self;
475 // Constructors, destructor, assignment operator.
476 complex(value_type __x = 0.0, value_type __y = 0.0)
477 : _M_re(__x), _M_im(__y) {}
479 complex(const complex<long double>& __z)
480 : _M_re(__z._M_re), _M_im(__z._M_im) {}
481 inline complex(const complex<float>& __z);
482 inline complex(const complex<double>& __z);
485 value_type real() const { return _M_re; }
486 value_type imag() const { return _M_im; }
488 // Arithmetic op= operations involving one real argument.
490 _Self& operator= (value_type __x) {
495 _Self& operator+= (value_type __x) {
499 _Self& operator-= (value_type __x) {
503 _Self& operator*= (value_type __x) {
508 _Self& operator/= (value_type __x) {
514 // Arithmetic op= operations involving two complex arguments.
516 _STLP_DECLSPEC static void _STLP_CALL _div(const long double& __z1_r, const long double& __z1_i,
517 const long double& __z2_r, const long double& __z2_i,
518 long double& __res_r, long double& __res_i);
520 _STLP_DECLSPEC static void _STLP_CALL _div(const long double& __z1_r,
521 const long double& __z2_r, const long double& __z2_i,
522 long double& __res_r, long double& __res_i);
524 #if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
526 template <class _Tp2>
527 complex<long double>& operator=(const complex<_Tp2>& __z) {
533 template <class _Tp2>
534 complex<long double>& operator+= (const complex<_Tp2>& __z) {
540 template <class _Tp2>
541 complex<long double>& operator-= (const complex<_Tp2>& __z) {
547 template <class _Tp2>
548 complex<long double>& operator*= (const complex<_Tp2>& __z) {
549 long double __r = _M_re * __z._M_re - _M_im * __z._M_im;
550 long double __i = _M_re * __z._M_im + _M_im * __z._M_re;
556 template <class _Tp2>
557 complex<long double>& operator/= (const complex<_Tp2>& __z) {
560 _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
566 #endif /* _STLP_MEMBER_TEMPLATES */
568 _Self& operator=(const _Self& __z) {
574 _Self& operator+= (const _Self& __z) {
580 _Self& operator-= (const _Self& __z) {
586 _Self& operator*= (const _Self& __z) {
587 value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
588 value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
594 _Self& operator/= (const _Self& __z) {
597 _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
608 # endif /* _STLP_NO_LONG_DOUBLE */
610 // Converting constructors from one of these three specialized types
613 inline complex<float>::complex(const complex<double>& __z)
614 : _M_re(__z._M_re), _M_im(__z._M_im) {}
615 inline complex<double>::complex(const complex<float>& __z)
616 : _M_re(__z._M_re), _M_im(__z._M_im) {}
617 # ifndef _STLP_NO_LONG_DOUBLE
618 inline complex<float>::complex(const complex<long double>& __z)
619 : _M_re(__z._M_re), _M_im(__z._M_im) {}
620 inline complex<double>::complex(const complex<long double>& __z)
621 : _M_re(__z._M_re), _M_im(__z._M_im) {}
622 inline complex<long double>::complex(const complex<float>& __z)
623 : _M_re(__z._M_re), _M_im(__z._M_im) {}
624 inline complex<long double>::complex(const complex<double>& __z)
625 : _M_re(__z._M_re), _M_im(__z._M_im) {}
628 # endif /* SPECIALIZATIONS */
630 // Unary non-member arithmetic operators.
633 inline complex<_Tp> _STLP_CALL operator+(const complex<_Tp>& __z) {
638 inline complex<_Tp> _STLP_CALL operator-(const complex<_Tp>& __z) {
639 return complex<_Tp>(-__z._M_re, -__z._M_im);
642 // Non-member arithmetic operations involving one real argument.
645 inline complex<_Tp> _STLP_CALL operator+(const _Tp& __x, const complex<_Tp>& __z) {
646 return complex<_Tp>(__x + __z._M_re, __z._M_im);
650 inline complex<_Tp> _STLP_CALL operator+(const complex<_Tp>& __z, const _Tp& __x) {
651 return complex<_Tp>(__z._M_re + __x, __z._M_im);
655 inline complex<_Tp> _STLP_CALL operator-(const _Tp& __x, const complex<_Tp>& __z) {
656 return complex<_Tp>(__x - __z._M_re, -__z._M_im);
660 inline complex<_Tp> _STLP_CALL operator-(const complex<_Tp>& __z, const _Tp& __x) {
661 return complex<_Tp>(__z._M_re - __x, __z._M_im);
665 inline complex<_Tp> _STLP_CALL operator*(const _Tp& __x, const complex<_Tp>& __z) {
666 return complex<_Tp>(__x * __z._M_re, __x * __z._M_im);
670 inline complex<_Tp> _STLP_CALL operator*(const complex<_Tp>& __z, const _Tp& __x) {
671 return complex<_Tp>(__z._M_re * __x, __z._M_im * __x);
675 inline complex<_Tp> _STLP_CALL operator/(const _Tp& __x, const complex<_Tp>& __z) {
676 complex<_Tp> __result;
677 complex<_Tp>::_div(__x,
678 __z._M_re, __z._M_im,
679 __result._M_re, __result._M_im);
684 inline complex<_Tp> _STLP_CALL operator/(const complex<_Tp>& __z, const _Tp& __x) {
685 return complex<_Tp>(__z._M_re / __x, __z._M_im / __x);
688 // Non-member arithmetic operations involving two complex arguments
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);
697 inline complex<_Tp> _STLP_CALL
698 operator-(const complex<_Tp>& __z1, const complex<_Tp>& __z2) {
699 return complex<_Tp>(__z1._M_re - __z2._M_re, __z1._M_im - __z2._M_im);
703 inline complex<_Tp> _STLP_CALL
704 operator*(const complex<_Tp>& __z1, const complex<_Tp>& __z2) {
705 return complex<_Tp>(__z1._M_re * __z2._M_re - __z1._M_im * __z2._M_im,
706 __z1._M_re * __z2._M_im + __z1._M_im * __z2._M_re);
710 inline complex<_Tp> _STLP_CALL
711 operator/(const complex<_Tp>& __z1, const complex<_Tp>& __z2) {
712 complex<_Tp> __result;
713 complex<_Tp>::_div(__z1._M_re, __z1._M_im,
714 __z2._M_re, __z2._M_im,
715 __result._M_re, __result._M_im);
719 // Comparison operators.
722 inline bool _STLP_CALL operator==(const complex<_Tp>& __z1, const complex<_Tp>& __z2) {
723 return __z1._M_re == __z2._M_re && __z1._M_im == __z2._M_im;
727 inline bool _STLP_CALL operator==(const complex<_Tp>& __z, const _Tp& __x) {
728 return __z._M_re == __x && __z._M_im == 0;
732 inline bool _STLP_CALL operator==(const _Tp& __x, const complex<_Tp>& __z) {
733 return __x == __z._M_re && 0 == __z._M_im;
736 #ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER
739 inline bool _STLP_CALL operator!=(const complex<_Tp>& __z1, const complex<_Tp>& __z2) {
740 return __z1._M_re != __z2._M_re || __z1._M_im != __z2._M_im;
743 #endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */
746 inline bool _STLP_CALL operator!=(const complex<_Tp>& __z, const _Tp& __x) {
747 return __z._M_re != __x || __z._M_im != 0;
751 inline bool _STLP_CALL operator!=(const _Tp& __x, const complex<_Tp>& __z) {
752 return __x != __z._M_re || 0 != __z._M_im;
755 // Other basic arithmetic operations
758 inline _Tp _STLP_CALL real(const complex<_Tp>& __z) {
763 inline _Tp _STLP_CALL imag(const complex<_Tp>& __z) {
772 _Tp _STLP_CALL abs_tp(const complex<_Tp>&);
778 _Tp _STLP_CALL arg_tp(const complex<_Tp>&);
784 complex<_Tp> _STLP_CALL polar_tp(const _Tp& __rho, const _Tp& __phi);
787 _Tp _STLP_CALL abs(const complex<_Tp>& __z)
793 _Tp _STLP_CALL arg(const complex<_Tp>& __z)
799 complex<_Tp> _STLP_CALL polar(const _Tp& __rho, const _Tp& __phi) {
800 return polar_tp(__rho, __phi);
805 _Tp _STLP_CALL abs(const complex<_Tp>& __z) {
806 return _Tp(abs(complex<double>(double(__z.real()), double(__z.imag()))));
810 _Tp _STLP_CALL arg(const complex<_Tp>& __z) {
811 return _Tp(arg(complex<double>(double(__z.real()), double(__z.imag()))));
818 inline _Tp _STLP_CALL norm(const complex<_Tp>& __z) {
819 return __z._M_re * __z._M_re + __z._M_im * __z._M_im;
823 inline complex<_Tp> _STLP_CALL conj(const complex<_Tp>& __z) {
824 return complex<_Tp>(__z._M_re, -__z._M_im);
828 complex<_Tp> _STLP_CALL polar(const _Tp& __rho) {
829 return complex<_Tp>(__rho, 0);
832 #ifndef __SYMBIAN32__
834 complex<_Tp> _STLP_CALL polar(const _Tp& __rho, const _Tp& __phi) {
835 complex<double> __tmp = polar(double(__rho), double(__phi));
836 return complex<_Tp>(_Tp(__tmp.real()), _Tp(__tmp.imag()));
841 _STLP_DECLSPEC float _STLP_CALL abs(const complex<float>&);
842 #ifndef _STLP_COMPLEX_SPECIALIZATION_BUG
844 _STLP_DECLSPEC double _STLP_CALL abs(const complex<double>&);
846 _STLP_DECLSPEC double _STLP_CALL arg(const complex<double>&);
848 _STLP_DECLSPEC complex<double> _STLP_CALL polar(const double& __rho, const double& __phi);
851 _STLP_DECLSPEC float _STLP_CALL arg(const complex<float>&);
853 _STLP_DECLSPEC complex<float> _STLP_CALL polar(const float& __rho, const float& __phi);
856 # ifndef _STLP_NO_LONG_DOUBLE
858 _STLP_DECLSPEC long double _STLP_CALL arg(const complex<long double>&);
860 _STLP_DECLSPEC long double _STLP_CALL abs(const complex<long double>&);
862 _STLP_DECLSPEC complex<long double> _STLP_CALL polar(const long double&, const long double&);
867 #ifdef _STLP_USE_NEW_IOSTREAMS
869 // Complex output, in the form (re,im). We use a two-step process
870 // involving stringstream so that we get the padding right.
871 template <class _Tp, class _CharT, class _Traits>
872 basic_ostream<_CharT, _Traits>& _STLP_CALL
873 operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __z);
875 template <class _Tp, class _CharT, class _Traits>
876 basic_istream<_CharT, _Traits>& _STLP_CALL
877 operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __z);
879 // Specializations for narrow characters; lets us avoid widen.
881 _STLP_OPERATOR_TEMPLATE
882 _STLP_DECLSPEC basic_istream<char, char_traits<char> >& _STLP_CALL
883 operator>>(basic_istream<char, char_traits<char> >& __is, complex<float>& __z);
885 _STLP_OPERATOR_TEMPLATE
886 _STLP_DECLSPEC basic_istream<char, char_traits<char> >& _STLP_CALL
887 operator>>(basic_istream<char, char_traits<char> >& __is, complex<double>& __z);
890 _STLP_OPERATOR_TEMPLATE
891 _STLP_DECLSPEC basic_ostream<char, char_traits<char> >& _STLP_CALL
892 operator<<(basic_ostream<char, char_traits<char> >& __is, const complex<float>& __z);
894 _STLP_OPERATOR_TEMPLATE
895 _STLP_DECLSPEC basic_ostream<char, char_traits<char> >& _STLP_CALL
896 operator<<(basic_ostream<char, char_traits<char> >& __is, const complex<double>& __z);
898 # if ! defined (_STLP_NO_LONG_DOUBLE)
899 _STLP_OPERATOR_TEMPLATE
900 _STLP_DECLSPEC basic_istream<char, char_traits<char> >& _STLP_CALL
901 operator>>(basic_istream<char, char_traits<char> >& __is, complex<long double>& __z);
903 _STLP_OPERATOR_TEMPLATE
904 _STLP_DECLSPEC basic_ostream<char, char_traits<char> >& _STLP_CALL
905 operator<<(basic_ostream<char, char_traits<char> >& __is, const complex<long double>& __z);
909 # if defined (_STLP_USE_TEMPLATE_EXPORT) && ! defined (_STLP_NO_WCHAR_T)
911 _STLP_EXPORT_TEMPLATE basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL operator>>(
912 basic_istream<wchar_t, char_traits<wchar_t> >&, complex<double>&);
913 _STLP_EXPORT_TEMPLATE basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL operator<<(
914 basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<double>&);
915 _STLP_EXPORT_TEMPLATE basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL operator>>(
916 basic_istream<wchar_t, char_traits<wchar_t> >&, complex<float>&);
917 _STLP_EXPORT_TEMPLATE basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL operator<<(
918 basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<float>&);
920 # ifndef _STLP_NO_LONG_DOUBLE
921 _STLP_EXPORT_TEMPLATE basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL operator>>(
922 basic_istream<wchar_t, char_traits<wchar_t> >&, complex<long double>&);
923 _STLP_EXPORT_TEMPLATE basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL operator<<(
924 basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<long double>&);
927 # endif /* USE_TEMPLATE_EXPORT */
929 #else /* _STLP_USE_NEW_IOSTREAMS */
932 ostream& _STLP_CALL operator<<(ostream& s, const complex<_Tp>& __z);
935 istream& _STLP_CALL operator>>(istream& s, complex<_Tp>& a);
937 #endif /* _STLP_USE_NEW_IOSTREAMS */
940 // Transcendental functions. These are defined only for float,
941 // double, and long double. (Sqrt isn't transcendental, of course,
942 // but it's included in this section anyway.)
944 _STLP_DECLSPEC complex<float> _STLP_CALL sqrt(const complex<float>&);
946 _STLP_DECLSPEC complex<float> _STLP_CALL exp(const complex<float>&);
947 _STLP_DECLSPEC complex<float> _STLP_CALL log(const complex<float>&);
948 _STLP_DECLSPEC complex<float> _STLP_CALL log10(const complex<float>&);
950 _STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>&, int);
951 _STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>&, const float&);
952 _STLP_DECLSPEC complex<float> _STLP_CALL pow(const float&, const complex<float>&);
953 _STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>&, const complex<float>&);
955 _STLP_DECLSPEC complex<float> _STLP_CALL sin(const complex<float>&);
956 _STLP_DECLSPEC complex<float> _STLP_CALL cos(const complex<float>&);
957 _STLP_DECLSPEC complex<float> _STLP_CALL tan(const complex<float>&);
959 _STLP_DECLSPEC complex<float> _STLP_CALL sinh(const complex<float>&);
960 _STLP_DECLSPEC complex<float> _STLP_CALL cosh(const complex<float>&);
961 _STLP_DECLSPEC complex<float> _STLP_CALL tanh(const complex<float>&);
963 _STLP_DECLSPEC complex<double> _STLP_CALL sqrt(const complex<double>&);
965 _STLP_DECLSPEC complex<double> _STLP_CALL exp(const complex<double>&);
966 _STLP_DECLSPEC complex<double> _STLP_CALL log(const complex<double>&);
967 _STLP_DECLSPEC complex<double> _STLP_CALL log10(const complex<double>&);
969 _STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>&, int);
970 _STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>&, const double&);
971 _STLP_DECLSPEC complex<double> _STLP_CALL pow(const double&, const complex<double>&);
972 _STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>&, const complex<double>&);
974 _STLP_DECLSPEC complex<double> _STLP_CALL sin(const complex<double>&);
975 _STLP_DECLSPEC complex<double> _STLP_CALL cos(const complex<double>&);
976 _STLP_DECLSPEC complex<double> _STLP_CALL tan(const complex<double>&);
978 _STLP_DECLSPEC complex<double> _STLP_CALL sinh(const complex<double>&);
979 _STLP_DECLSPEC complex<double> _STLP_CALL cosh(const complex<double>&);
980 _STLP_DECLSPEC complex<double> _STLP_CALL tanh(const complex<double>&);
982 # ifndef _STLP_NO_LONG_DOUBLE
983 _STLP_DECLSPEC complex<long double> _STLP_CALL sqrt(const complex<long double>&);
984 _STLP_DECLSPEC complex<long double> _STLP_CALL exp(const complex<long double>&);
985 _STLP_DECLSPEC complex<long double> _STLP_CALL log(const complex<long double>&);
986 _STLP_DECLSPEC complex<long double> _STLP_CALL log10(const complex<long double>&);
988 _STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>&, int);
989 _STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>&, const long double&);
990 _STLP_DECLSPEC complex<long double> _STLP_CALL pow(const long double&, const complex<long double>&);
991 _STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>&,
992 const complex<long double>&);
994 _STLP_DECLSPEC complex<long double> _STLP_CALL sin(const complex<long double>&);
995 _STLP_DECLSPEC complex<long double> _STLP_CALL cos(const complex<long double>&);
996 _STLP_DECLSPEC complex<long double> _STLP_CALL tan(const complex<long double>&);
998 _STLP_DECLSPEC complex<long double> _STLP_CALL sinh(const complex<long double>&);
999 _STLP_DECLSPEC complex<long double> _STLP_CALL cosh(const complex<long double>&);
1000 _STLP_DECLSPEC complex<long double> _STLP_CALL tanh(const complex<long double>&);
1005 # ifndef _STLP_LINK_TIME_INSTANTIATION
1006 # include <stl/_complex.c>
1009 #endif /* _STLP_template_complex */