18#ifndef _STLP_COMPLEX_C
19#define _STLP_COMPLEX_C
21#ifndef _STLP_INTERNAL_COMPLEX
25#if !defined (_STLP_USE_NO_IOSTREAMS)
26# ifndef _STLP_INTERNAL_ISTREAM
30# ifndef _STLP_INTERNAL_SSTREAM
34# ifndef _STLP_STRING_IO_H
45 const _Tp& __z2_r,
const _Tp& __z2_i,
46 _Tp& __res_r, _Tp& __res_i) {
47 _Tp __ar = __z2_r >= 0 ? __z2_r : -__z2_r;
48 _Tp __ai = __z2_i >= 0 ? __z2_i : -__z2_i;
51 _Tp __ratio = __z2_r / __z2_i;
52 _Tp __denom = __z2_i * (1 + __ratio * __ratio);
53 __res_r = (__z1_r * __ratio + __z1_i) / __denom;
54 __res_i = (__z1_i * __ratio - __z1_r) / __denom;
57 _Tp __ratio = __z2_i / __z2_r;
58 _Tp __denom = __z2_r * (1 + __ratio * __ratio);
59 __res_r = (__z1_r + __z1_i * __ratio) / __denom;
60 __res_i = (__z1_i - __z1_r * __ratio) / __denom;
66 const _Tp& __z2_r,
const _Tp& __z2_i,
67 _Tp& __res_r, _Tp& __res_i) {
68 _Tp __ar = __z2_r >= 0 ? __z2_r : -__z2_r;
69 _Tp __ai = __z2_i >= 0 ? __z2_i : -__z2_i;
72 _Tp __ratio = __z2_r / __z2_i;
73 _Tp __denom = __z2_i * (1 + __ratio * __ratio);
74 __res_r = (__z1_r * __ratio) / __denom;
75 __res_i = - __z1_r / __denom;
78 _Tp __ratio = __z2_i / __z2_r;
79 _Tp __denom = __z2_r * (1 + __ratio * __ratio);
80 __res_r = __z1_r / __denom;
81 __res_i = - (__z1_r * __ratio) / __denom;
86#if !defined (_STLP_USE_NO_IOSTREAMS)
90template <
class _Tp,
class _CharT,
class _Traits>
97 __tmp <<
'(' << __z.
real() <<
',' << __z.
imag() <<
')';
98 return __os << __tmp.
str();
105template <
class _Tp,
class _CharT,
class _Traits>
113 const char __punct[4] =
"(,)";
115 __c_type.widen(__punct, __punct + 3, __wpunct);
120 if (_Traits::eq(
__c, __wpunct[0])) {
122 if (_Traits::eq(
__c, __wpunct[1]))
124 if (!_Traits::eq(
__c, __wpunct[2]))
basic_ostream< _CharT, _Traits > &_STLP_CALL operator<<(basic_ostream< _CharT, _Traits > &__os, const complex< _Tp > &__z)
basic_istream< _CharT, _Traits > &_STLP_CALL operator>>(basic_istream< _CharT, _Traits > &__is, complex< _Tp > &__z)
locale imbue(const locale &)
const ctype< char_type > * _M_ctype_facet() const
void setstate(iostate __state)
_Self & putback(char_type __c)
streamsize precision() const
#define _STLP_BEGIN_NAMESPACE
#define _STLP_END_NAMESPACE
static void _STLP_CALL _div(const value_type &__z1_r, const value_type &__z1_i, const value_type &__z2_r, const value_type &__z2_i, value_type &__res_r, value_type &__res_i)