29#ifndef _GLIBCXX_TR1_COMPLEX
30#define _GLIBCXX_TR1_COMPLEX 1
33#pragma GCC system_header
40namespace std _GLIBCXX_VISIBILITY(default)
42_GLIBCXX_BEGIN_NAMESPACE_VERSION
51#if __cplusplus >= 201103L
70#if __cplusplus < 201103L
71 template<
typename _Tp>
76 const _Tp __pi_2 = 1.5707963267948966192313216916397514L;
80#if _GLIBCXX_USE_C99_COMPLEX_TR1
81 inline __complex__
float
82 __complex_acos(__complex__
float __z)
83 {
return __builtin_cacosf(__z); }
85 inline __complex__
double
86 __complex_acos(__complex__
double __z)
87 {
return __builtin_cacos(__z); }
89 inline __complex__
long double
90 __complex_acos(
const __complex__
long double& __z)
91 {
return __builtin_cacosl(__z); }
93 template<
typename _Tp>
96 {
return __complex_acos(__z.__rep()); }
101 template<
typename _Tp>
104 {
return __complex_acos(__z); }
107 template<
typename _Tp>
112 __t = std::tr1::asinh(__t);
116#if _GLIBCXX_USE_C99_COMPLEX_TR1
117 inline __complex__
float
118 __complex_asin(__complex__
float __z)
119 {
return __builtin_casinf(__z); }
121 inline __complex__
double
122 __complex_asin(__complex__
double __z)
123 {
return __builtin_casin(__z); }
125 inline __complex__
long double
126 __complex_asin(
const __complex__
long double& __z)
127 {
return __builtin_casinl(__z); }
129 template<
typename _Tp>
132 {
return __complex_asin(__z.__rep()); }
137 template<
typename _Tp>
140 {
return __complex_asin(__z); }
143 template<
typename _Tp>
147 const _Tp __r2 = __z.real() * __z.real();
148 const _Tp __x = _Tp(1.0) - __r2 - __z.imag() * __z.imag();
150 _Tp __num = __z.imag() + _Tp(1.0);
151 _Tp __den = __z.imag() - _Tp(1.0);
153 __num = __r2 + __num * __num;
154 __den = __r2 + __den * __den;
157 _Tp(0.25) *
log(__num / __den));
160#if _GLIBCXX_USE_C99_COMPLEX_TR1
161 inline __complex__
float
162 __complex_atan(__complex__
float __z)
163 {
return __builtin_catanf(__z); }
165 inline __complex__
double
166 __complex_atan(__complex__
double __z)
167 {
return __builtin_catan(__z); }
169 inline __complex__
long double
170 __complex_atan(
const __complex__
long double& __z)
171 {
return __builtin_catanl(__z); }
173 template<
typename _Tp>
176 {
return __complex_atan(__z.__rep()); }
181 template<
typename _Tp>
184 {
return __complex_atan(__z); }
187 template<
typename _Tp>
193 +
std::sqrt(_Tp(0.5) * (__z - _Tp(1.0))));
196#if _GLIBCXX_USE_C99_COMPLEX_TR1
197 inline __complex__
float
198 __complex_acosh(__complex__
float __z)
199 {
return __builtin_cacoshf(__z); }
201 inline __complex__
double
202 __complex_acosh(__complex__
double __z)
203 {
return __builtin_cacosh(__z); }
205 inline __complex__
long double
206 __complex_acosh(
const __complex__
long double& __z)
207 {
return __builtin_cacoshl(__z); }
209 template<
typename _Tp>
212 {
return __complex_acosh(__z.__rep()); }
217 template<
typename _Tp>
220 {
return __complex_acosh(__z); }
223 template<
typename _Tp>
228 * (__z.real() + __z.imag()) + _Tp(1.0),
229 _Tp(2.0) * __z.real() * __z.imag());
235#if _GLIBCXX_USE_C99_COMPLEX_TR1
236 inline __complex__
float
237 __complex_asinh(__complex__
float __z)
238 {
return __builtin_casinhf(__z); }
240 inline __complex__
double
241 __complex_asinh(__complex__
double __z)
242 {
return __builtin_casinh(__z); }
244 inline __complex__
long double
245 __complex_asinh(
const __complex__
long double& __z)
246 {
return __builtin_casinhl(__z); }
248 template<
typename _Tp>
251 {
return __complex_asinh(__z.__rep()); }
256 template<
typename _Tp>
259 {
return __complex_asinh(__z); }
262 template<
typename _Tp>
266 const _Tp __i2 = __z.imag() * __z.imag();
267 const _Tp __x = _Tp(1.0) - __i2 - __z.real() * __z.real();
269 _Tp __num = _Tp(1.0) + __z.real();
270 _Tp __den = _Tp(1.0) - __z.real();
272 __num = __i2 + __num * __num;
273 __den = __i2 + __den * __den;
276 _Tp(0.5) * atan2(_Tp(2.0) * __z.imag(), __x));
279#if _GLIBCXX_USE_C99_COMPLEX_TR1
280 inline __complex__
float
281 __complex_atanh(__complex__
float __z)
282 {
return __builtin_catanhf(__z); }
284 inline __complex__
double
285 __complex_atanh(__complex__
double __z)
286 {
return __builtin_catanh(__z); }
288 inline __complex__
long double
289 __complex_atanh(
const __complex__
long double& __z)
290 {
return __builtin_catanhl(__z); }
292 template<
typename _Tp>
295 {
return __complex_atanh(__z.__rep()); }
300 template<
typename _Tp>
303 {
return __complex_atanh(__z); }
308 template<
typename _Tp>
317#if __cplusplus < 201103L
319 template<
typename _Tp>
320 inline typename __gnu_cxx::__promote<_Tp>::__type
323 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
324#if (_GLIBCXX_USE_C99_MATH && !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC)
325 return std::signbit(__x) ? __type(3.1415926535897932384626433832795029L)
332 template<
typename _Tp>
333 inline typename __gnu_cxx::__promote<_Tp>::__type
337 template<
typename _Tp>
338 inline typename __gnu_cxx::__promote<_Tp>::__type
341 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
342 return __type(__x) * __type(__x);
345 template<
typename _Tp>
346 inline typename __gnu_cxx::__promote<_Tp>::__type
352 template<
typename _Tp,
typename _Up>
356 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
360 template<
typename _Tp,
typename _Up>
364 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
368 template<
typename _Tp,
typename _Up>
372 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
379 template<
typename _Tp>
384 template<
typename _Tp>
393 template<
typename _Tp,
typename _Up>
395 polar(
const _Tp& __rho,
const _Up& __theta)
397 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
398 return std::polar(__type(__rho), __type(__theta));
403 template<
typename _Tp>
408 template<
typename _Tp>
413 template<
typename _Tp>
421_GLIBCXX_END_NAMESPACE_VERSION
complex< _Tp > log(const complex< _Tp > &)
Return complex natural logarithm of z.
complex< _Tp > polar(const _Tp &, const _Tp &=0)
Return complex with magnitude rho and angle theta.
_Tp abs(const complex< _Tp > &)
Return magnitude of z.
_Tp arg(const complex< _Tp > &)
Return phase angle of z.
constexpr complex< _Tp > conj(const complex< _Tp > &)
Return complex conjugate of z.
complex< _Tp > pow(const complex< _Tp > &, int)
Return x to the y'th power.
_Tp constexpr norm(const complex< _Tp > &)
Return z magnitude squared.
complex< _Tp > sqrt(const complex< _Tp > &)
Return complex square root of z.
ISO C++ entities toplevel namespace is std.