complex: Trivial stylistic changes...
[gcc.git] / libstdc++-v3 / include / std / complex
1 // The template and inlines for the -*- C++ -*- complex number classes.
2
3 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
4 // 2006, 2007, 2008
5 // Free Software Foundation, Inc.
6 //
7 // This file is part of the GNU ISO C++ Library. This library is free
8 // software; you can redistribute it and/or modify it under the
9 // terms of the GNU General Public License as published by the
10 // Free Software Foundation; either version 2, or (at your option)
11 // any later version.
12
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
17
18 // You should have received a copy of the GNU General Public License
19 // along with this library; see the file COPYING. If not, write to
20 // the Free Software Foundation, 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301, USA.
22
23 // As a special exception, you may use this file as part of a free software
24 // library without restriction. Specifically, if other files instantiate
25 // templates or use macros or inline functions from this file, or you compile
26 // this file and link it with other files to produce an executable, this
27 // file does not by itself cause the resulting executable to be covered by
28 // the GNU General Public License. This exception does not however
29 // invalidate any other reasons why the executable file might be covered by
30 // the GNU General Public License.
31
32 /** @file complex
33 * This is a Standard C++ Library header.
34 */
35
36 //
37 // ISO C++ 14882: 26.2 Complex Numbers
38 // Note: this is not a conforming implementation.
39 // Initially implemented by Ulrich Drepper <drepper@cygnus.com>
40 // Improved by Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
41 //
42
43 #ifndef _GLIBCXX_COMPLEX
44 #define _GLIBCXX_COMPLEX 1
45
46 #pragma GCC system_header
47
48 #include <bits/c++config.h>
49 #include <bits/cpp_type_traits.h>
50 #include <ext/type_traits.h>
51 #include <cmath>
52 #include <sstream>
53
54 _GLIBCXX_BEGIN_NAMESPACE(std)
55
56 // Forward declarations.
57 template<typename _Tp> class complex;
58 template<> class complex<float>;
59 template<> class complex<double>;
60 template<> class complex<long double>;
61
62 /// Return magnitude of @a z.
63 template<typename _Tp> _Tp abs(const complex<_Tp>&);
64 /// Return phase angle of @a z.
65 template<typename _Tp> _Tp arg(const complex<_Tp>&);
66 /// Return @a z magnitude squared.
67 template<typename _Tp> _Tp norm(const complex<_Tp>&);
68
69 /// Return complex conjugate of @a z.
70 template<typename _Tp> complex<_Tp> conj(const complex<_Tp>&);
71 /// Return complex with magnitude @a rho and angle @a theta.
72 template<typename _Tp> complex<_Tp> polar(const _Tp&, const _Tp& = 0);
73
74 // Transcendentals:
75 /// Return complex cosine of @a z.
76 template<typename _Tp> complex<_Tp> cos(const complex<_Tp>&);
77 /// Return complex hyperbolic cosine of @a z.
78 template<typename _Tp> complex<_Tp> cosh(const complex<_Tp>&);
79 /// Return complex base e exponential of @a z.
80 template<typename _Tp> complex<_Tp> exp(const complex<_Tp>&);
81 /// Return complex natural logarithm of @a z.
82 template<typename _Tp> complex<_Tp> log(const complex<_Tp>&);
83 /// Return complex base 10 logarithm of @a z.
84 template<typename _Tp> complex<_Tp> log10(const complex<_Tp>&);
85 /// Return complex cosine of @a z.
86 template<typename _Tp> complex<_Tp> pow(const complex<_Tp>&, int);
87 /// Return @a x to the @a y'th power.
88 template<typename _Tp> complex<_Tp> pow(const complex<_Tp>&, const _Tp&);
89 /// Return @a x to the @a y'th power.
90 template<typename _Tp> complex<_Tp> pow(const complex<_Tp>&,
91 const complex<_Tp>&);
92 /// Return @a x to the @a y'th power.
93 template<typename _Tp> complex<_Tp> pow(const _Tp&, const complex<_Tp>&);
94 /// Return complex sine of @a z.
95 template<typename _Tp> complex<_Tp> sin(const complex<_Tp>&);
96 /// Return complex hyperbolic sine of @a z.
97 template<typename _Tp> complex<_Tp> sinh(const complex<_Tp>&);
98 /// Return complex square root of @a z.
99 template<typename _Tp> complex<_Tp> sqrt(const complex<_Tp>&);
100 /// Return complex tangent of @a z.
101 template<typename _Tp> complex<_Tp> tan(const complex<_Tp>&);
102 /// Return complex hyperbolic tangent of @a z.
103 template<typename _Tp> complex<_Tp> tanh(const complex<_Tp>&);
104 //@}
105
106
107 // 26.2.2 Primary template class complex
108 /**
109 * Template to represent complex numbers.
110 *
111 * Specializations for float, double, and long double are part of the
112 * library. Results with any other type are not guaranteed.
113 *
114 * @param Tp Type of real and imaginary values.
115 */
116 template<typename _Tp>
117 struct complex
118 {
119 /// Value typedef.
120 typedef _Tp value_type;
121
122 /// Default constructor. First parameter is x, second parameter is y.
123 /// Unspecified parameters default to 0.
124 complex(const _Tp& __r = _Tp(), const _Tp& __i = _Tp())
125 : _M_real(__r), _M_imag(__i) { }
126
127 // Lets the compiler synthesize the copy constructor
128 // complex (const complex<_Tp>&);
129 /// Copy constructor.
130 template<typename _Up>
131 complex(const complex<_Up>& __z)
132 : _M_real(__z.real()), _M_imag(__z.imag()) { }
133
134 /// Return real part of complex number.
135 _Tp& real()
136 { return _M_real; }
137
138 /// Return real part of complex number.
139 const _Tp& real() const
140 { return _M_real; }
141
142 /// Return imaginary part of complex number.
143 _Tp& imag()
144 { return _M_imag; }
145
146 /// Return imaginary part of complex number.
147 const _Tp& imag() const
148 { return _M_imag; }
149
150 /// Assign this complex number to scalar @a t.
151 complex<_Tp>& operator=(const _Tp&);
152
153 /// Add @a t to this complex number.
154 // 26.2.5/1
155 complex<_Tp>&
156 operator+=(const _Tp& __t)
157 {
158 _M_real += __t;
159 return *this;
160 }
161
162 /// Subtract @a t from this complex number.
163 // 26.2.5/3
164 complex<_Tp>&
165 operator-=(const _Tp& __t)
166 {
167 _M_real -= __t;
168 return *this;
169 }
170
171 /// Multiply this complex number by @a t.
172 complex<_Tp>& operator*=(const _Tp&);
173 /// Divide this complex number by @a t.
174 complex<_Tp>& operator/=(const _Tp&);
175
176 // Lets the compiler synthesize the
177 // copy and assignment operator
178 // complex<_Tp>& operator= (const complex<_Tp>&);
179 /// Assign this complex number to complex @a z.
180 template<typename _Up>
181 complex<_Tp>& operator=(const complex<_Up>&);
182 /// Add @a z to this complex number.
183 template<typename _Up>
184 complex<_Tp>& operator+=(const complex<_Up>&);
185 /// Subtract @a z from this complex number.
186 template<typename _Up>
187 complex<_Tp>& operator-=(const complex<_Up>&);
188 /// Multiply this complex number by @a z.
189 template<typename _Up>
190 complex<_Tp>& operator*=(const complex<_Up>&);
191 /// Divide this complex number by @a z.
192 template<typename _Up>
193 complex<_Tp>& operator/=(const complex<_Up>&);
194
195 const complex& __rep() const
196 { return *this; }
197
198 private:
199 _Tp _M_real;
200 _Tp _M_imag;
201 };
202
203 template<typename _Tp>
204 complex<_Tp>&
205 complex<_Tp>::operator=(const _Tp& __t)
206 {
207 _M_real = __t;
208 _M_imag = _Tp();
209 return *this;
210 }
211
212 // 26.2.5/5
213 template<typename _Tp>
214 complex<_Tp>&
215 complex<_Tp>::operator*=(const _Tp& __t)
216 {
217 _M_real *= __t;
218 _M_imag *= __t;
219 return *this;
220 }
221
222 // 26.2.5/7
223 template<typename _Tp>
224 complex<_Tp>&
225 complex<_Tp>::operator/=(const _Tp& __t)
226 {
227 _M_real /= __t;
228 _M_imag /= __t;
229 return *this;
230 }
231
232 template<typename _Tp>
233 template<typename _Up>
234 complex<_Tp>&
235 complex<_Tp>::operator=(const complex<_Up>& __z)
236 {
237 _M_real = __z.real();
238 _M_imag = __z.imag();
239 return *this;
240 }
241
242 // 26.2.5/9
243 template<typename _Tp>
244 template<typename _Up>
245 complex<_Tp>&
246 complex<_Tp>::operator+=(const complex<_Up>& __z)
247 {
248 _M_real += __z.real();
249 _M_imag += __z.imag();
250 return *this;
251 }
252
253 // 26.2.5/11
254 template<typename _Tp>
255 template<typename _Up>
256 complex<_Tp>&
257 complex<_Tp>::operator-=(const complex<_Up>& __z)
258 {
259 _M_real -= __z.real();
260 _M_imag -= __z.imag();
261 return *this;
262 }
263
264 // 26.2.5/13
265 // XXX: This is a grammar school implementation.
266 template<typename _Tp>
267 template<typename _Up>
268 complex<_Tp>&
269 complex<_Tp>::operator*=(const complex<_Up>& __z)
270 {
271 const _Tp __r = _M_real * __z.real() - _M_imag * __z.imag();
272 _M_imag = _M_real * __z.imag() + _M_imag * __z.real();
273 _M_real = __r;
274 return *this;
275 }
276
277 // 26.2.5/15
278 // XXX: This is a grammar school implementation.
279 template<typename _Tp>
280 template<typename _Up>
281 complex<_Tp>&
282 complex<_Tp>::operator/=(const complex<_Up>& __z)
283 {
284 const _Tp __r = _M_real * __z.real() + _M_imag * __z.imag();
285 const _Tp __n = std::norm(__z);
286 _M_imag = (_M_imag * __z.real() - _M_real * __z.imag()) / __n;
287 _M_real = __r / __n;
288 return *this;
289 }
290
291 // Operators:
292 //@{
293 /// Return new complex value @a x plus @a y.
294 template<typename _Tp>
295 inline complex<_Tp>
296 operator+(const complex<_Tp>& __x, const complex<_Tp>& __y)
297 {
298 complex<_Tp> __r = __x;
299 __r += __y;
300 return __r;
301 }
302
303 template<typename _Tp>
304 inline complex<_Tp>
305 operator+(const complex<_Tp>& __x, const _Tp& __y)
306 {
307 complex<_Tp> __r = __x;
308 __r.real() += __y;
309 return __r;
310 }
311
312 template<typename _Tp>
313 inline complex<_Tp>
314 operator+(const _Tp& __x, const complex<_Tp>& __y)
315 {
316 complex<_Tp> __r = __y;
317 __r.real() += __x;
318 return __r;
319 }
320 //@}
321
322 //@{
323 /// Return new complex value @a x minus @a y.
324 template<typename _Tp>
325 inline complex<_Tp>
326 operator-(const complex<_Tp>& __x, const complex<_Tp>& __y)
327 {
328 complex<_Tp> __r = __x;
329 __r -= __y;
330 return __r;
331 }
332
333 template<typename _Tp>
334 inline complex<_Tp>
335 operator-(const complex<_Tp>& __x, const _Tp& __y)
336 {
337 complex<_Tp> __r = __x;
338 __r.real() -= __y;
339 return __r;
340 }
341
342 template<typename _Tp>
343 inline complex<_Tp>
344 operator-(const _Tp& __x, const complex<_Tp>& __y)
345 {
346 complex<_Tp> __r(__x, -__y.imag());
347 __r.real() -= __y.real();
348 return __r;
349 }
350 //@}
351
352 //@{
353 /// Return new complex value @a x times @a y.
354 template<typename _Tp>
355 inline complex<_Tp>
356 operator*(const complex<_Tp>& __x, const complex<_Tp>& __y)
357 {
358 complex<_Tp> __r = __x;
359 __r *= __y;
360 return __r;
361 }
362
363 template<typename _Tp>
364 inline complex<_Tp>
365 operator*(const complex<_Tp>& __x, const _Tp& __y)
366 {
367 complex<_Tp> __r = __x;
368 __r *= __y;
369 return __r;
370 }
371
372 template<typename _Tp>
373 inline complex<_Tp>
374 operator*(const _Tp& __x, const complex<_Tp>& __y)
375 {
376 complex<_Tp> __r = __y;
377 __r *= __x;
378 return __r;
379 }
380 //@}
381
382 //@{
383 /// Return new complex value @a x divided by @a y.
384 template<typename _Tp>
385 inline complex<_Tp>
386 operator/(const complex<_Tp>& __x, const complex<_Tp>& __y)
387 {
388 complex<_Tp> __r = __x;
389 __r /= __y;
390 return __r;
391 }
392
393 template<typename _Tp>
394 inline complex<_Tp>
395 operator/(const complex<_Tp>& __x, const _Tp& __y)
396 {
397 complex<_Tp> __r = __x;
398 __r /= __y;
399 return __r;
400 }
401
402 template<typename _Tp>
403 inline complex<_Tp>
404 operator/(const _Tp& __x, const complex<_Tp>& __y)
405 {
406 complex<_Tp> __r = __x;
407 __r /= __y;
408 return __r;
409 }
410 //@}
411
412 /// Return @a x.
413 template<typename _Tp>
414 inline complex<_Tp>
415 operator+(const complex<_Tp>& __x)
416 { return __x; }
417
418 /// Return complex negation of @a x.
419 template<typename _Tp>
420 inline complex<_Tp>
421 operator-(const complex<_Tp>& __x)
422 { return complex<_Tp>(-__x.real(), -__x.imag()); }
423
424 //@{
425 /// Return true if @a x is equal to @a y.
426 template<typename _Tp>
427 inline bool
428 operator==(const complex<_Tp>& __x, const complex<_Tp>& __y)
429 { return __x.real() == __y.real() && __x.imag() == __y.imag(); }
430
431 template<typename _Tp>
432 inline bool
433 operator==(const complex<_Tp>& __x, const _Tp& __y)
434 { return __x.real() == __y && __x.imag() == _Tp(); }
435
436 template<typename _Tp>
437 inline bool
438 operator==(const _Tp& __x, const complex<_Tp>& __y)
439 { return __x == __y.real() && _Tp() == __y.imag(); }
440 //@}
441
442 //@{
443 /// Return false if @a x is equal to @a y.
444 template<typename _Tp>
445 inline bool
446 operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y)
447 { return __x.real() != __y.real() || __x.imag() != __y.imag(); }
448
449 template<typename _Tp>
450 inline bool
451 operator!=(const complex<_Tp>& __x, const _Tp& __y)
452 { return __x.real() != __y || __x.imag() != _Tp(); }
453
454 template<typename _Tp>
455 inline bool
456 operator!=(const _Tp& __x, const complex<_Tp>& __y)
457 { return __x != __y.real() || _Tp() != __y.imag(); }
458 //@}
459
460 /// Extraction operator for complex values.
461 template<typename _Tp, typename _CharT, class _Traits>
462 basic_istream<_CharT, _Traits>&
463 operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)
464 {
465 _Tp __re_x, __im_x;
466 _CharT __ch;
467 __is >> __ch;
468 if (__ch == '(')
469 {
470 __is >> __re_x >> __ch;
471 if (__ch == ',')
472 {
473 __is >> __im_x >> __ch;
474 if (__ch == ')')
475 __x = complex<_Tp>(__re_x, __im_x);
476 else
477 __is.setstate(ios_base::failbit);
478 }
479 else if (__ch == ')')
480 __x = __re_x;
481 else
482 __is.setstate(ios_base::failbit);
483 }
484 else
485 {
486 __is.putback(__ch);
487 __is >> __re_x;
488 __x = __re_x;
489 }
490 return __is;
491 }
492
493 /// Insertion operator for complex values.
494 template<typename _Tp, typename _CharT, class _Traits>
495 basic_ostream<_CharT, _Traits>&
496 operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)
497 {
498 basic_ostringstream<_CharT, _Traits> __s;
499 __s.flags(__os.flags());
500 __s.imbue(__os.getloc());
501 __s.precision(__os.precision());
502 __s << '(' << __x.real() << ',' << __x.imag() << ')';
503 return __os << __s.str();
504 }
505
506 // Values
507 template<typename _Tp>
508 inline _Tp&
509 real(complex<_Tp>& __z)
510 { return __z.real(); }
511
512 template<typename _Tp>
513 inline const _Tp&
514 real(const complex<_Tp>& __z)
515 { return __z.real(); }
516
517 template<typename _Tp>
518 inline _Tp&
519 imag(complex<_Tp>& __z)
520 { return __z.imag(); }
521
522 template<typename _Tp>
523 inline const _Tp&
524 imag(const complex<_Tp>& __z)
525 { return __z.imag(); }
526
527 // 26.2.7/3 abs(__z): Returns the magnitude of __z.
528 template<typename _Tp>
529 inline _Tp
530 __complex_abs(const complex<_Tp>& __z)
531 {
532 _Tp __x = __z.real();
533 _Tp __y = __z.imag();
534 const _Tp __s = std::max(abs(__x), abs(__y));
535 if (__s == _Tp()) // well ...
536 return __s;
537 __x /= __s;
538 __y /= __s;
539 return __s * sqrt(__x * __x + __y * __y);
540 }
541
542 #if _GLIBCXX_USE_C99_COMPLEX
543 inline float
544 __complex_abs(__complex__ float __z) { return __builtin_cabsf(__z); }
545
546 inline double
547 __complex_abs(__complex__ double __z) { return __builtin_cabs(__z); }
548
549 inline long double
550 __complex_abs(const __complex__ long double& __z)
551 { return __builtin_cabsl(__z); }
552
553 template<typename _Tp>
554 inline _Tp
555 abs(const complex<_Tp>& __z) { return __complex_abs(__z.__rep()); }
556 #else
557 template<typename _Tp>
558 inline _Tp
559 abs(const complex<_Tp>& __z) { return __complex_abs(__z); }
560 #endif
561
562
563 // 26.2.7/4: arg(__z): Returns the phase angle of __z.
564 template<typename _Tp>
565 inline _Tp
566 __complex_arg(const complex<_Tp>& __z)
567 { return atan2(__z.imag(), __z.real()); }
568
569 #if _GLIBCXX_USE_C99_COMPLEX
570 inline float
571 __complex_arg(__complex__ float __z) { return __builtin_cargf(__z); }
572
573 inline double
574 __complex_arg(__complex__ double __z) { return __builtin_carg(__z); }
575
576 inline long double
577 __complex_arg(const __complex__ long double& __z)
578 { return __builtin_cargl(__z); }
579
580 template<typename _Tp>
581 inline _Tp
582 arg(const complex<_Tp>& __z) { return __complex_arg(__z.__rep()); }
583 #else
584 template<typename _Tp>
585 inline _Tp
586 arg(const complex<_Tp>& __z) { return __complex_arg(__z); }
587 #endif
588
589 // 26.2.7/5: norm(__z) returns the squared magnitude of __z.
590 // As defined, norm() is -not- a norm is the common mathematical
591 // sens used in numerics. The helper class _Norm_helper<> tries to
592 // distinguish between builtin floating point and the rest, so as
593 // to deliver an answer as close as possible to the real value.
594 template<bool>
595 struct _Norm_helper
596 {
597 template<typename _Tp>
598 static inline _Tp _S_do_it(const complex<_Tp>& __z)
599 {
600 const _Tp __x = __z.real();
601 const _Tp __y = __z.imag();
602 return __x * __x + __y * __y;
603 }
604 };
605
606 template<>
607 struct _Norm_helper<true>
608 {
609 template<typename _Tp>
610 static inline _Tp _S_do_it(const complex<_Tp>& __z)
611 {
612 _Tp __res = std::abs(__z);
613 return __res * __res;
614 }
615 };
616
617 template<typename _Tp>
618 inline _Tp
619 norm(const complex<_Tp>& __z)
620 {
621 return _Norm_helper<__is_floating<_Tp>::__value
622 && !_GLIBCXX_FAST_MATH>::_S_do_it(__z);
623 }
624
625 template<typename _Tp>
626 inline complex<_Tp>
627 polar(const _Tp& __rho, const _Tp& __theta)
628 { return complex<_Tp>(__rho * cos(__theta), __rho * sin(__theta)); }
629
630 template<typename _Tp>
631 inline complex<_Tp>
632 conj(const complex<_Tp>& __z)
633 { return complex<_Tp>(__z.real(), -__z.imag()); }
634
635 // Transcendentals
636
637 // 26.2.8/1 cos(__z): Returns the cosine of __z.
638 template<typename _Tp>
639 inline complex<_Tp>
640 __complex_cos(const complex<_Tp>& __z)
641 {
642 const _Tp __x = __z.real();
643 const _Tp __y = __z.imag();
644 return complex<_Tp>(cos(__x) * cosh(__y), -sin(__x) * sinh(__y));
645 }
646
647 #if _GLIBCXX_USE_C99_COMPLEX
648 inline __complex__ float
649 __complex_cos(__complex__ float __z) { return __builtin_ccosf(__z); }
650
651 inline __complex__ double
652 __complex_cos(__complex__ double __z) { return __builtin_ccos(__z); }
653
654 inline __complex__ long double
655 __complex_cos(const __complex__ long double& __z)
656 { return __builtin_ccosl(__z); }
657
658 template<typename _Tp>
659 inline complex<_Tp>
660 cos(const complex<_Tp>& __z) { return __complex_cos(__z.__rep()); }
661 #else
662 template<typename _Tp>
663 inline complex<_Tp>
664 cos(const complex<_Tp>& __z) { return __complex_cos(__z); }
665 #endif
666
667 // 26.2.8/2 cosh(__z): Returns the hyperbolic cosine of __z.
668 template<typename _Tp>
669 inline complex<_Tp>
670 __complex_cosh(const complex<_Tp>& __z)
671 {
672 const _Tp __x = __z.real();
673 const _Tp __y = __z.imag();
674 return complex<_Tp>(cosh(__x) * cos(__y), sinh(__x) * sin(__y));
675 }
676
677 #if _GLIBCXX_USE_C99_COMPLEX
678 inline __complex__ float
679 __complex_cosh(__complex__ float __z) { return __builtin_ccoshf(__z); }
680
681 inline __complex__ double
682 __complex_cosh(__complex__ double __z) { return __builtin_ccosh(__z); }
683
684 inline __complex__ long double
685 __complex_cosh(const __complex__ long double& __z)
686 { return __builtin_ccoshl(__z); }
687
688 template<typename _Tp>
689 inline complex<_Tp>
690 cosh(const complex<_Tp>& __z) { return __complex_cosh(__z.__rep()); }
691 #else
692 template<typename _Tp>
693 inline complex<_Tp>
694 cosh(const complex<_Tp>& __z) { return __complex_cosh(__z); }
695 #endif
696
697 // 26.2.8/3 exp(__z): Returns the complex base e exponential of x
698 template<typename _Tp>
699 inline complex<_Tp>
700 __complex_exp(const complex<_Tp>& __z)
701 { return std::polar(exp(__z.real()), __z.imag()); }
702
703 #if _GLIBCXX_USE_C99_COMPLEX
704 inline __complex__ float
705 __complex_exp(__complex__ float __z) { return __builtin_cexpf(__z); }
706
707 inline __complex__ double
708 __complex_exp(__complex__ double __z) { return __builtin_cexp(__z); }
709
710 inline __complex__ long double
711 __complex_exp(const __complex__ long double& __z)
712 { return __builtin_cexpl(__z); }
713
714 template<typename _Tp>
715 inline complex<_Tp>
716 exp(const complex<_Tp>& __z) { return __complex_exp(__z.__rep()); }
717 #else
718 template<typename _Tp>
719 inline complex<_Tp>
720 exp(const complex<_Tp>& __z) { return __complex_exp(__z); }
721 #endif
722
723 // 26.2.8/5 log(__z): Returns the natural complex logarithm of __z.
724 // The branch cut is along the negative axis.
725 template<typename _Tp>
726 inline complex<_Tp>
727 __complex_log(const complex<_Tp>& __z)
728 { return complex<_Tp>(log(std::abs(__z)), std::arg(__z)); }
729
730 #if _GLIBCXX_USE_C99_COMPLEX
731 inline __complex__ float
732 __complex_log(__complex__ float __z) { return __builtin_clogf(__z); }
733
734 inline __complex__ double
735 __complex_log(__complex__ double __z) { return __builtin_clog(__z); }
736
737 inline __complex__ long double
738 __complex_log(const __complex__ long double& __z)
739 { return __builtin_clogl(__z); }
740
741 template<typename _Tp>
742 inline complex<_Tp>
743 log(const complex<_Tp>& __z) { return __complex_log(__z.__rep()); }
744 #else
745 template<typename _Tp>
746 inline complex<_Tp>
747 log(const complex<_Tp>& __z) { return __complex_log(__z); }
748 #endif
749
750 template<typename _Tp>
751 inline complex<_Tp>
752 log10(const complex<_Tp>& __z)
753 { return std::log(__z) / log(_Tp(10.0)); }
754
755 // 26.2.8/10 sin(__z): Returns the sine of __z.
756 template<typename _Tp>
757 inline complex<_Tp>
758 __complex_sin(const complex<_Tp>& __z)
759 {
760 const _Tp __x = __z.real();
761 const _Tp __y = __z.imag();
762 return complex<_Tp>(sin(__x) * cosh(__y), cos(__x) * sinh(__y));
763 }
764
765 #if _GLIBCXX_USE_C99_COMPLEX
766 inline __complex__ float
767 __complex_sin(__complex__ float __z) { return __builtin_csinf(__z); }
768
769 inline __complex__ double
770 __complex_sin(__complex__ double __z) { return __builtin_csin(__z); }
771
772 inline __complex__ long double
773 __complex_sin(const __complex__ long double& __z)
774 { return __builtin_csinl(__z); }
775
776 template<typename _Tp>
777 inline complex<_Tp>
778 sin(const complex<_Tp>& __z) { return __complex_sin(__z.__rep()); }
779 #else
780 template<typename _Tp>
781 inline complex<_Tp>
782 sin(const complex<_Tp>& __z) { return __complex_sin(__z); }
783 #endif
784
785 // 26.2.8/11 sinh(__z): Returns the hyperbolic sine of __z.
786 template<typename _Tp>
787 inline complex<_Tp>
788 __complex_sinh(const complex<_Tp>& __z)
789 {
790 const _Tp __x = __z.real();
791 const _Tp __y = __z.imag();
792 return complex<_Tp>(sinh(__x) * cos(__y), cosh(__x) * sin(__y));
793 }
794
795 #if _GLIBCXX_USE_C99_COMPLEX
796 inline __complex__ float
797 __complex_sinh(__complex__ float __z) { return __builtin_csinhf(__z); }
798
799 inline __complex__ double
800 __complex_sinh(__complex__ double __z) { return __builtin_csinh(__z); }
801
802 inline __complex__ long double
803 __complex_sinh(const __complex__ long double& __z)
804 { return __builtin_csinhl(__z); }
805
806 template<typename _Tp>
807 inline complex<_Tp>
808 sinh(const complex<_Tp>& __z) { return __complex_sinh(__z.__rep()); }
809 #else
810 template<typename _Tp>
811 inline complex<_Tp>
812 sinh(const complex<_Tp>& __z) { return __complex_sinh(__z); }
813 #endif
814
815 // 26.2.8/13 sqrt(__z): Returns the complex square root of __z.
816 // The branch cut is on the negative axis.
817 template<typename _Tp>
818 complex<_Tp>
819 __complex_sqrt(const complex<_Tp>& __z)
820 {
821 _Tp __x = __z.real();
822 _Tp __y = __z.imag();
823
824 if (__x == _Tp())
825 {
826 _Tp __t = sqrt(abs(__y) / 2);
827 return complex<_Tp>(__t, __y < _Tp() ? -__t : __t);
828 }
829 else
830 {
831 _Tp __t = sqrt(2 * (std::abs(__z) + abs(__x)));
832 _Tp __u = __t / 2;
833 return __x > _Tp()
834 ? complex<_Tp>(__u, __y / __t)
835 : complex<_Tp>(abs(__y) / __t, __y < _Tp() ? -__u : __u);
836 }
837 }
838
839 #if _GLIBCXX_USE_C99_COMPLEX
840 inline __complex__ float
841 __complex_sqrt(__complex__ float __z) { return __builtin_csqrtf(__z); }
842
843 inline __complex__ double
844 __complex_sqrt(__complex__ double __z) { return __builtin_csqrt(__z); }
845
846 inline __complex__ long double
847 __complex_sqrt(const __complex__ long double& __z)
848 { return __builtin_csqrtl(__z); }
849
850 template<typename _Tp>
851 inline complex<_Tp>
852 sqrt(const complex<_Tp>& __z) { return __complex_sqrt(__z.__rep()); }
853 #else
854 template<typename _Tp>
855 inline complex<_Tp>
856 sqrt(const complex<_Tp>& __z) { return __complex_sqrt(__z); }
857 #endif
858
859 // 26.2.8/14 tan(__z): Return the complex tangent of __z.
860
861 template<typename _Tp>
862 inline complex<_Tp>
863 __complex_tan(const complex<_Tp>& __z)
864 { return std::sin(__z) / std::cos(__z); }
865
866 #if _GLIBCXX_USE_C99_COMPLEX
867 inline __complex__ float
868 __complex_tan(__complex__ float __z) { return __builtin_ctanf(__z); }
869
870 inline __complex__ double
871 __complex_tan(__complex__ double __z) { return __builtin_ctan(__z); }
872
873 inline __complex__ long double
874 __complex_tan(const __complex__ long double& __z)
875 { return __builtin_ctanl(__z); }
876
877 template<typename _Tp>
878 inline complex<_Tp>
879 tan(const complex<_Tp>& __z) { return __complex_tan(__z.__rep()); }
880 #else
881 template<typename _Tp>
882 inline complex<_Tp>
883 tan(const complex<_Tp>& __z) { return __complex_tan(__z); }
884 #endif
885
886
887 // 26.2.8/15 tanh(__z): Returns the hyperbolic tangent of __z.
888
889 template<typename _Tp>
890 inline complex<_Tp>
891 __complex_tanh(const complex<_Tp>& __z)
892 { return std::sinh(__z) / std::cosh(__z); }
893
894 #if _GLIBCXX_USE_C99_COMPLEX
895 inline __complex__ float
896 __complex_tanh(__complex__ float __z) { return __builtin_ctanhf(__z); }
897
898 inline __complex__ double
899 __complex_tanh(__complex__ double __z) { return __builtin_ctanh(__z); }
900
901 inline __complex__ long double
902 __complex_tanh(const __complex__ long double& __z)
903 { return __builtin_ctanhl(__z); }
904
905 template<typename _Tp>
906 inline complex<_Tp>
907 tanh(const complex<_Tp>& __z) { return __complex_tanh(__z.__rep()); }
908 #else
909 template<typename _Tp>
910 inline complex<_Tp>
911 tanh(const complex<_Tp>& __z) { return __complex_tanh(__z); }
912 #endif
913
914
915 // 26.2.8/9 pow(__x, __y): Returns the complex power base of __x
916 // raised to the __y-th power. The branch
917 // cut is on the negative axis.
918 template<typename _Tp>
919 inline complex<_Tp>
920 pow(const complex<_Tp>& __z, int __n)
921 { return std::__pow_helper(__z, __n); }
922
923 template<typename _Tp>
924 complex<_Tp>
925 pow(const complex<_Tp>& __x, const _Tp& __y)
926 {
927 #ifndef _GLIBCXX_USE_C99_COMPLEX
928 if (__x == _Tp())
929 return _Tp();
930 #endif
931 if (__x.imag() == _Tp() && __x.real() > _Tp())
932 return pow(__x.real(), __y);
933
934 complex<_Tp> __t = std::log(__x);
935 return std::polar(exp(__y * __t.real()), __y * __t.imag());
936 }
937
938 template<typename _Tp>
939 inline complex<_Tp>
940 __complex_pow(const complex<_Tp>& __x, const complex<_Tp>& __y)
941 { return __x == _Tp() ? _Tp() : std::exp(__y * std::log(__x)); }
942
943 #if _GLIBCXX_USE_C99_COMPLEX
944 inline __complex__ float
945 __complex_pow(__complex__ float __x, __complex__ float __y)
946 { return __builtin_cpowf(__x, __y); }
947
948 inline __complex__ double
949 __complex_pow(__complex__ double __x, __complex__ double __y)
950 { return __builtin_cpow(__x, __y); }
951
952 inline __complex__ long double
953 __complex_pow(const __complex__ long double& __x,
954 const __complex__ long double& __y)
955 { return __builtin_cpowl(__x, __y); }
956
957 template<typename _Tp>
958 inline complex<_Tp>
959 pow(const complex<_Tp>& __x, const complex<_Tp>& __y)
960 { return __complex_pow(__x.__rep(), __y.__rep()); }
961 #else
962 template<typename _Tp>
963 inline complex<_Tp>
964 pow(const complex<_Tp>& __x, const complex<_Tp>& __y)
965 { return __complex_pow(__x, __y); }
966 #endif
967
968 template<typename _Tp>
969 inline complex<_Tp>
970 pow(const _Tp& __x, const complex<_Tp>& __y)
971 {
972 return __x > _Tp() ? std::polar(pow(__x, __y.real()),
973 __y.imag() * log(__x))
974 : std::pow(complex<_Tp>(__x), __y);
975 }
976
977 // 26.2.3 complex specializations
978 // complex<float> specialization
979 template<>
980 struct complex<float>
981 {
982 typedef float value_type;
983 typedef __complex__ float _ComplexT;
984
985 complex(_ComplexT __z) : _M_value(__z) { }
986
987 complex(float __r = 0.0f, float __i = 0.0f)
988 {
989 __real__ _M_value = __r;
990 __imag__ _M_value = __i;
991 }
992
993 explicit complex(const complex<double>&);
994 explicit complex(const complex<long double>&);
995
996 float& real()
997 { return __real__ _M_value; }
998
999 const float& real() const
1000 { return __real__ _M_value; }
1001
1002 float& imag()
1003 { return __imag__ _M_value; }
1004
1005 const float& imag() const
1006 { return __imag__ _M_value; }
1007
1008 complex<float>&
1009 operator=(float __f)
1010 {
1011 __real__ _M_value = __f;
1012 __imag__ _M_value = 0.0f;
1013 return *this;
1014 }
1015
1016 complex<float>&
1017 operator+=(float __f)
1018 {
1019 __real__ _M_value += __f;
1020 return *this;
1021 }
1022
1023 complex<float>&
1024 operator-=(float __f)
1025 {
1026 __real__ _M_value -= __f;
1027 return *this;
1028 }
1029
1030 complex<float>&
1031 operator*=(float __f)
1032 {
1033 _M_value *= __f;
1034 return *this;
1035 }
1036
1037 complex<float>&
1038 operator/=(float __f)
1039 {
1040 _M_value /= __f;
1041 return *this;
1042 }
1043
1044 // Let the compiler synthesize the copy and assignment
1045 // operator. It always does a pretty good job.
1046 // complex& operator=(const complex&);
1047
1048 template<typename _Tp>
1049 complex<float>&
1050 operator=(const complex<_Tp>& __z)
1051 {
1052 __real__ _M_value = __z.real();
1053 __imag__ _M_value = __z.imag();
1054 return *this;
1055 }
1056
1057 template<typename _Tp>
1058 complex<float>&
1059 operator+=(const complex<_Tp>& __z)
1060 {
1061 __real__ _M_value += __z.real();
1062 __imag__ _M_value += __z.imag();
1063 return *this;
1064 }
1065
1066 template<class _Tp>
1067 complex<float>&
1068 operator-=(const complex<_Tp>& __z)
1069 {
1070 __real__ _M_value -= __z.real();
1071 __imag__ _M_value -= __z.imag();
1072 return *this;
1073 }
1074
1075 template<class _Tp>
1076 complex<float>&
1077 operator*=(const complex<_Tp>& __z)
1078 {
1079 _ComplexT __t;
1080 __real__ __t = __z.real();
1081 __imag__ __t = __z.imag();
1082 _M_value *= __t;
1083 return *this;
1084 }
1085
1086 template<class _Tp>
1087 complex<float>&
1088 operator/=(const complex<_Tp>& __z)
1089 {
1090 _ComplexT __t;
1091 __real__ __t = __z.real();
1092 __imag__ __t = __z.imag();
1093 _M_value /= __t;
1094 return *this;
1095 }
1096
1097 const _ComplexT& __rep() const { return _M_value; }
1098
1099 private:
1100 _ComplexT _M_value;
1101 };
1102
1103 // 26.2.3 complex specializations
1104 // complex<double> specialization
1105 template<>
1106 struct complex<double>
1107 {
1108 typedef double value_type;
1109 typedef __complex__ double _ComplexT;
1110
1111 complex(_ComplexT __z) : _M_value(__z) { }
1112
1113 complex(double __r = 0.0, double __i = 0.0)
1114 {
1115 __real__ _M_value = __r;
1116 __imag__ _M_value = __i;
1117 }
1118
1119 complex(const complex<float>& __z)
1120 : _M_value(__z.__rep()) { }
1121
1122 explicit complex(const complex<long double>&);
1123
1124 double& real()
1125 { return __real__ _M_value; }
1126
1127 const double& real() const
1128 { return __real__ _M_value; }
1129
1130 double& imag()
1131 { return __imag__ _M_value; }
1132
1133 const double& imag() const
1134 { return __imag__ _M_value; }
1135
1136 complex<double>&
1137 operator=(double __d)
1138 {
1139 __real__ _M_value = __d;
1140 __imag__ _M_value = 0.0;
1141 return *this;
1142 }
1143
1144 complex<double>&
1145 operator+=(double __d)
1146 {
1147 __real__ _M_value += __d;
1148 return *this;
1149 }
1150
1151 complex<double>&
1152 operator-=(double __d)
1153 {
1154 __real__ _M_value -= __d;
1155 return *this;
1156 }
1157
1158 complex<double>&
1159 operator*=(double __d)
1160 {
1161 _M_value *= __d;
1162 return *this;
1163 }
1164
1165 complex<double>&
1166 operator/=(double __d)
1167 {
1168 _M_value /= __d;
1169 return *this;
1170 }
1171
1172 // The compiler will synthesize this, efficiently.
1173 // complex& operator=(const complex&);
1174
1175 template<typename _Tp>
1176 complex<double>&
1177 operator=(const complex<_Tp>& __z)
1178 {
1179 __real__ _M_value = __z.real();
1180 __imag__ _M_value = __z.imag();
1181 return *this;
1182 }
1183
1184 template<typename _Tp>
1185 complex<double>&
1186 operator+=(const complex<_Tp>& __z)
1187 {
1188 __real__ _M_value += __z.real();
1189 __imag__ _M_value += __z.imag();
1190 return *this;
1191 }
1192
1193 template<typename _Tp>
1194 complex<double>&
1195 operator-=(const complex<_Tp>& __z)
1196 {
1197 __real__ _M_value -= __z.real();
1198 __imag__ _M_value -= __z.imag();
1199 return *this;
1200 }
1201
1202 template<typename _Tp>
1203 complex<double>&
1204 operator*=(const complex<_Tp>& __z)
1205 {
1206 _ComplexT __t;
1207 __real__ __t = __z.real();
1208 __imag__ __t = __z.imag();
1209 _M_value *= __t;
1210 return *this;
1211 }
1212
1213 template<typename _Tp>
1214 complex<double>&
1215 operator/=(const complex<_Tp>& __z)
1216 {
1217 _ComplexT __t;
1218 __real__ __t = __z.real();
1219 __imag__ __t = __z.imag();
1220 _M_value /= __t;
1221 return *this;
1222 }
1223
1224 const _ComplexT& __rep() const { return _M_value; }
1225
1226 private:
1227 _ComplexT _M_value;
1228 };
1229
1230 // 26.2.3 complex specializations
1231 // complex<long double> specialization
1232 template<>
1233 struct complex<long double>
1234 {
1235 typedef long double value_type;
1236 typedef __complex__ long double _ComplexT;
1237
1238 complex(_ComplexT __z) : _M_value(__z) { }
1239
1240 complex(long double __r = 0.0L, long double __i = 0.0L)
1241 {
1242 __real__ _M_value = __r;
1243 __imag__ _M_value = __i;
1244 }
1245
1246 complex(const complex<float>& __z)
1247 : _M_value(__z.__rep()) { }
1248
1249 complex(const complex<double>& __z)
1250 : _M_value(__z.__rep()) { }
1251
1252 long double& real()
1253 { return __real__ _M_value; }
1254
1255 const long double& real() const
1256 { return __real__ _M_value; }
1257
1258 long double& imag()
1259 { return __imag__ _M_value; }
1260
1261 const long double& imag() const
1262 { return __imag__ _M_value; }
1263
1264 complex<long double>&
1265 operator=(long double __r)
1266 {
1267 __real__ _M_value = __r;
1268 __imag__ _M_value = 0.0L;
1269 return *this;
1270 }
1271
1272 complex<long double>&
1273 operator+=(long double __r)
1274 {
1275 __real__ _M_value += __r;
1276 return *this;
1277 }
1278
1279 complex<long double>&
1280 operator-=(long double __r)
1281 {
1282 __real__ _M_value -= __r;
1283 return *this;
1284 }
1285
1286 complex<long double>&
1287 operator*=(long double __r)
1288 {
1289 _M_value *= __r;
1290 return *this;
1291 }
1292
1293 complex<long double>&
1294 operator/=(long double __r)
1295 {
1296 _M_value /= __r;
1297 return *this;
1298 }
1299
1300 // The compiler knows how to do this efficiently
1301 // complex& operator=(const complex&);
1302
1303 template<typename _Tp>
1304 complex<long double>&
1305 operator=(const complex<_Tp>& __z)
1306 {
1307 __real__ _M_value = __z.real();
1308 __imag__ _M_value = __z.imag();
1309 return *this;
1310 }
1311
1312 template<typename _Tp>
1313 complex<long double>&
1314 operator+=(const complex<_Tp>& __z)
1315 {
1316 __real__ _M_value += __z.real();
1317 __imag__ _M_value += __z.imag();
1318 return *this;
1319 }
1320
1321 template<typename _Tp>
1322 complex<long double>&
1323 operator-=(const complex<_Tp>& __z)
1324 {
1325 __real__ _M_value -= __z.real();
1326 __imag__ _M_value -= __z.imag();
1327 return *this;
1328 }
1329
1330 template<typename _Tp>
1331 complex<long double>&
1332 operator*=(const complex<_Tp>& __z)
1333 {
1334 _ComplexT __t;
1335 __real__ __t = __z.real();
1336 __imag__ __t = __z.imag();
1337 _M_value *= __t;
1338 return *this;
1339 }
1340
1341 template<typename _Tp>
1342 complex<long double>&
1343 operator/=(const complex<_Tp>& __z)
1344 {
1345 _ComplexT __t;
1346 __real__ __t = __z.real();
1347 __imag__ __t = __z.imag();
1348 _M_value /= __t;
1349 return *this;
1350 }
1351
1352 const _ComplexT& __rep() const { return _M_value; }
1353
1354 private:
1355 _ComplexT _M_value;
1356 };
1357
1358 // These bits have to be at the end of this file, so that the
1359 // specializations have all been defined.
1360 // ??? No, they have to be there because of compiler limitation at
1361 // inlining. It suffices that class specializations be defined.
1362 inline
1363 complex<float>::complex(const complex<double>& __z)
1364 : _M_value(__z.__rep()) { }
1365
1366 inline
1367 complex<float>::complex(const complex<long double>& __z)
1368 : _M_value(__z.__rep()) { }
1369
1370 inline
1371 complex<double>::complex(const complex<long double>& __z)
1372 : _M_value(__z.__rep()) { }
1373
1374 // Inhibit implicit instantiations for required instantiations,
1375 // which are defined via explicit instantiations elsewhere.
1376 // NB: This syntax is a GNU extension.
1377 #if _GLIBCXX_EXTERN_TEMPLATE
1378 extern template istream& operator>>(istream&, complex<float>&);
1379 extern template ostream& operator<<(ostream&, const complex<float>&);
1380 extern template istream& operator>>(istream&, complex<double>&);
1381 extern template ostream& operator<<(ostream&, const complex<double>&);
1382 extern template istream& operator>>(istream&, complex<long double>&);
1383 extern template ostream& operator<<(ostream&, const complex<long double>&);
1384
1385 #ifdef _GLIBCXX_USE_WCHAR_T
1386 extern template wistream& operator>>(wistream&, complex<float>&);
1387 extern template wostream& operator<<(wostream&, const complex<float>&);
1388 extern template wistream& operator>>(wistream&, complex<double>&);
1389 extern template wostream& operator<<(wostream&, const complex<double>&);
1390 extern template wistream& operator>>(wistream&, complex<long double>&);
1391 extern template wostream& operator<<(wostream&, const complex<long double>&);
1392 #endif
1393 #endif
1394
1395 _GLIBCXX_END_NAMESPACE
1396
1397 _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
1398
1399 // See ext/type_traits.h for the primary template.
1400 template<typename _Tp, typename _Up>
1401 struct __promote_2<std::complex<_Tp>, _Up>
1402 {
1403 public:
1404 typedef std::complex<typename __promote_2<_Tp, _Up>::__type> __type;
1405 };
1406
1407 template<typename _Tp, typename _Up>
1408 struct __promote_2<_Tp, std::complex<_Up> >
1409 {
1410 public:
1411 typedef std::complex<typename __promote_2<_Tp, _Up>::__type> __type;
1412 };
1413
1414 template<typename _Tp, typename _Up>
1415 struct __promote_2<std::complex<_Tp>, std::complex<_Up> >
1416 {
1417 public:
1418 typedef std::complex<typename __promote_2<_Tp, _Up>::__type> __type;
1419 };
1420
1421 _GLIBCXX_END_NAMESPACE
1422
1423 #ifdef __GXX_EXPERIMENTAL_CXX0X__
1424 # if defined(_GLIBCXX_INCLUDE_AS_TR1)
1425 # error C++0x header cannot be included from TR1 header
1426 # endif
1427 # if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
1428 # include <tr1_impl/complex>
1429 # else
1430 # define _GLIBCXX_INCLUDE_AS_CXX0X
1431 # define _GLIBCXX_BEGIN_NAMESPACE_TR1
1432 # define _GLIBCXX_END_NAMESPACE_TR1
1433 # define _GLIBCXX_TR1
1434 # include <tr1_impl/complex>
1435 # undef _GLIBCXX_TR1
1436 # undef _GLIBCXX_END_NAMESPACE_TR1
1437 # undef _GLIBCXX_BEGIN_NAMESPACE_TR1
1438 # undef _GLIBCXX_INCLUDE_AS_CXX0X
1439 # endif
1440
1441 _GLIBCXX_BEGIN_NAMESPACE(std)
1442
1443 // Forward declarations.
1444 // DR 781.
1445 template<typename _Tp> std::complex<_Tp> proj(const std::complex<_Tp>&);
1446
1447 template<typename _Tp>
1448 std::complex<_Tp>
1449 __complex_proj(const std::complex<_Tp>& __z)
1450 {
1451 const _Tp __den = (__z.real() * __z.real()
1452 + __z.imag() * __z.imag() + _Tp(1.0));
1453
1454 return std::complex<_Tp>((_Tp(2.0) * __z.real()) / __den,
1455 (_Tp(2.0) * __z.imag()) / __den);
1456 }
1457
1458 #if _GLIBCXX_USE_C99_COMPLEX
1459 inline __complex__ float
1460 __complex_proj(__complex__ float __z)
1461 { return __builtin_cprojf(__z); }
1462
1463 inline __complex__ double
1464 __complex_proj(__complex__ double __z)
1465 { return __builtin_cproj(__z); }
1466
1467 inline __complex__ long double
1468 __complex_proj(const __complex__ long double& __z)
1469 { return __builtin_cprojl(__z); }
1470
1471 template<typename _Tp>
1472 inline std::complex<_Tp>
1473 proj(const std::complex<_Tp>& __z)
1474 { return __complex_proj(__z.__rep()); }
1475 #else
1476 template<typename _Tp>
1477 inline std::complex<_Tp>
1478 proj(const std::complex<_Tp>& __z)
1479 { return __complex_proj(__z); }
1480 #endif
1481
1482 template<typename _Tp>
1483 inline std::complex<typename __gnu_cxx::__promote<_Tp>::__type>
1484 proj(_Tp __x)
1485 {
1486 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1487 return std::proj(std::complex<__type>(__x));
1488 }
1489
1490 _GLIBCXX_END_NAMESPACE
1491
1492 #endif
1493
1494 #endif /* _GLIBCXX_COMPLEX */