29#ifndef _GLIBCXX_TR1_COMPLEX
30#define _GLIBCXX_TR1_COMPLEX 1
32#pragma GCC system_header
38namespace std _GLIBCXX_VISIBILITY(default)
40_GLIBCXX_BEGIN_NAMESPACE_VERSION
49#if __cplusplus >= 201103L
68#if __cplusplus < 201103L
69 template<
typename _Tp>
74 const _Tp __pi_2 = 1.5707963267948966192313216916397514L;
78#if _GLIBCXX_USE_C99_COMPLEX_TR1
79 inline __complex__
float
80 __complex_acos(__complex__
float __z)
81 {
return __builtin_cacosf(__z); }
83 inline __complex__
double
84 __complex_acos(__complex__
double __z)
85 {
return __builtin_cacos(__z); }
87 inline __complex__
long double
88 __complex_acos(
const __complex__
long double& __z)
89 {
return __builtin_cacosl(__z); }
91 template<
typename _Tp>
94 {
return __complex_acos(__z.__rep()); }
99 template<
typename _Tp>
102 {
return __complex_acos(__z); }
105 template<
typename _Tp>
110 __t = std::tr1::asinh(__t);
114#if _GLIBCXX_USE_C99_COMPLEX_TR1
115 inline __complex__
float
116 __complex_asin(__complex__
float __z)
117 {
return __builtin_casinf(__z); }
119 inline __complex__
double
120 __complex_asin(__complex__
double __z)
121 {
return __builtin_casin(__z); }
123 inline __complex__
long double
124 __complex_asin(
const __complex__
long double& __z)
125 {
return __builtin_casinl(__z); }
127 template<
typename _Tp>
130 {
return __complex_asin(__z.__rep()); }
135 template<
typename _Tp>
138 {
return __complex_asin(__z); }
141 template<
typename _Tp>
145 const _Tp __r2 = __z.real() * __z.real();
146 const _Tp __x = _Tp(1.0) - __r2 - __z.imag() * __z.imag();
148 _Tp __num = __z.imag() + _Tp(1.0);
149 _Tp __den = __z.imag() - _Tp(1.0);
151 __num = __r2 + __num * __num;
152 __den = __r2 + __den * __den;
155 _Tp(0.25) *
log(__num / __den));
158#if _GLIBCXX_USE_C99_COMPLEX_TR1
159 inline __complex__
float
160 __complex_atan(__complex__
float __z)
161 {
return __builtin_catanf(__z); }
163 inline __complex__
double
164 __complex_atan(__complex__
double __z)
165 {
return __builtin_catan(__z); }
167 inline __complex__
long double
168 __complex_atan(
const __complex__
long double& __z)
169 {
return __builtin_catanl(__z); }
171 template<
typename _Tp>
174 {
return __complex_atan(__z.__rep()); }
179 template<
typename _Tp>
182 {
return __complex_atan(__z); }
185 template<
typename _Tp>
191 +
std::sqrt(_Tp(0.5) * (__z - _Tp(1.0))));
194#if _GLIBCXX_USE_C99_COMPLEX_TR1
195 inline __complex__
float
196 __complex_acosh(__complex__
float __z)
197 {
return __builtin_cacoshf(__z); }
199 inline __complex__
double
200 __complex_acosh(__complex__
double __z)
201 {
return __builtin_cacosh(__z); }
203 inline __complex__
long double
204 __complex_acosh(
const __complex__
long double& __z)
205 {
return __builtin_cacoshl(__z); }
207 template<
typename _Tp>
210 {
return __complex_acosh(__z.__rep()); }
215 template<
typename _Tp>
218 {
return __complex_acosh(__z); }
221 template<
typename _Tp>
226 * (__z.real() + __z.imag()) + _Tp(1.0),
227 _Tp(2.0) * __z.real() * __z.imag());
233#if _GLIBCXX_USE_C99_COMPLEX_TR1
234 inline __complex__
float
235 __complex_asinh(__complex__
float __z)
236 {
return __builtin_casinhf(__z); }
238 inline __complex__
double
239 __complex_asinh(__complex__
double __z)
240 {
return __builtin_casinh(__z); }
242 inline __complex__
long double
243 __complex_asinh(
const __complex__
long double& __z)
244 {
return __builtin_casinhl(__z); }
246 template<
typename _Tp>
249 {
return __complex_asinh(__z.__rep()); }
254 template<
typename _Tp>
257 {
return __complex_asinh(__z); }
260 template<
typename _Tp>
264 const _Tp __i2 = __z.imag() * __z.imag();
265 const _Tp __x = _Tp(1.0) - __i2 - __z.real() * __z.real();
267 _Tp __num = _Tp(1.0) + __z.real();
268 _Tp __den = _Tp(1.0) - __z.real();
270 __num = __i2 + __num * __num;
271 __den = __i2 + __den * __den;
274 _Tp(0.5) * atan2(_Tp(2.0) * __z.imag(), __x));
277#if _GLIBCXX_USE_C99_COMPLEX_TR1
278 inline __complex__
float
279 __complex_atanh(__complex__
float __z)
280 {
return __builtin_catanhf(__z); }
282 inline __complex__
double
283 __complex_atanh(__complex__
double __z)
284 {
return __builtin_catanh(__z); }
286 inline __complex__
long double
287 __complex_atanh(
const __complex__
long double& __z)
288 {
return __builtin_catanhl(__z); }
290 template<
typename _Tp>
293 {
return __complex_atanh(__z.__rep()); }
298 template<
typename _Tp>
301 {
return __complex_atanh(__z); }
306 template<
typename _Tp>
315#if __cplusplus < 201103L
317 template<
typename _Tp>
318 inline typename __gnu_cxx::__promote<_Tp>::__type
321 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
322#if (_GLIBCXX_USE_C99_MATH && !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC)
323 return std::signbit(__x) ? __type(3.1415926535897932384626433832795029L)
330 template<
typename _Tp>
331 inline typename __gnu_cxx::__promote<_Tp>::__type
335 template<
typename _Tp>
336 inline typename __gnu_cxx::__promote<_Tp>::__type
339 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
340 return __type(__x) * __type(__x);
343 template<
typename _Tp>
344 inline typename __gnu_cxx::__promote<_Tp>::__type
350 template<
typename _Tp,
typename _Up>
354 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
358 template<
typename _Tp,
typename _Up>
362 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
366 template<
typename _Tp,
typename _Up>
370 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
377 template<
typename _Tp>
382 template<
typename _Tp>
391 template<
typename _Tp,
typename _Up>
393 polar(
const _Tp& __rho,
const _Up& __theta)
395 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
396 return std::polar(__type(__rho), __type(__theta));
401 template<
typename _Tp>
406 template<
typename _Tp>
411 template<
typename _Tp>
419_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.
_Tp fabs(const std::complex< _Tp > &)
fabs(__z) [8.1.8].