Apache C++ Standard Library Reference Guide

## <complex>

Library: Numerics

    Header

- Local Index
- Summary
- Synopsis
- See Also
- Standards Conformance

### Local Index

No Entries

### Summary

The header `<complex>` is part of the Numerics library of the C++ Standard Library. It defines the class template complex, the specializations of the class template complex on types `float`, `double`, and `long double`, and a number of functions for representing and manipulating complex numbers.

### Synopsis

    namespace std {
      template<class T> class complex;
      template<> class complex<float>;
      template<> class complex<double>;
      template<> class complex<long double>;

      template<class T>
      complex<T> operator+(const complex<T>&, const complex<T>&);
      template<class T> complex<T> operator+(const complex<T>&,
                                             const T&);
      template<class T> complex<T> operator+(const T&,
                                             const complex<T>&);

      template<class T> complex<T>
      operator-(const complex<T>&, const complex<T>&);
      template<class T> complex<T> operator-(const complex<T>&,
                                           const T&);
      template<class T> complex<T> operator-(const T&,
                                             const complex<T>&);

      template<class T> complex<T>
      operator*(const complex<T>&, const complex<T>&);
      template<class T> complex<T> operator*(const complex<T>&,
                                             const T&);
      template<class T> complex<T> operator*(const T&,
                                             const complex<T>&);

      template<class T> complex<T>
      operator/(const complex<T>&, const complex<T>&);
      template<class T> complex<T> operator/(const complex<T>&,
                                             const T&);
      template<class T> complex<T> operator/(const T&,
                                             const complex<T>&);

      template<class T> complex<T> operator+(const complex<T>&);
      template<class T> complex<T> operator-(const complex<T>&);

      template<class T> bool
      operator==(const complex<T>&, const complex<T>&);
      template<class T> bool operator==(const complex<T>&,
                                        const T&);
      template<class T> bool operator==(const T&,
                                        const complex<T>&);

      template<class T> bool operator!=(const complex<T>&,
                                        const complex<T>&);
      template<class T> bool operator!=(const complex<T>&,
                                        const T&);
      template<class T> bool operator!=(const T&,
                                        const complex<T>&);

      template<class T, class charT, class traits>
      basic_istream<charT, traits>&
      operator>>(basic_istream<charT, traits>&, complex<T>&);

      template<class T, class charT, class traits>
      basic_ostream<charT, traits>&
      operator<<(basic_ostream<charT, traits>&,
                 const complex<T>&);

      template<class T> T real(const complex<T>&);
      template<class T> T imag(const complex<T>&);

      template<class T> T abs(const complex<T>&);
      template<class T> T arg(const complex<T>&);
      template<class T> T norm(const complex<T>&);

      template<class T> complex<T> conj(const complex<T>&);
      template<class T> complex<T> polar(const T&, const T&);

      template<class T> complex<T> cos  (const complex<T>&);
      template<class T> complex<T> cosh (const complex<T>&);
      template<class T> complex<T> exp  (const complex<T>&);
      template<class T> complex<T> log  (const complex<T>&);
      template<class T> complex<T> log10(const complex<T>&);

      template<class T> complex<T> pow(const complex<T>&, int);
      template<class T> complex<T> pow(const complex<T>&,
                                       const T&);
      template<class T> complex<T> pow(const complex<T>&,
                                       const complex<T>&);
      template<class T> complex<T> pow(const T&,
                                       const complex<T>&);

      template<class T> complex<T> sin  (const complex<T>&);
      template<class T> complex<T> sinh (const complex<T>&);
      template<class T> complex<T> sqrt (const complex<T>&);
      template<class T> complex<T> tan  (const complex<T>&);
      template<class T> complex<T> tanh (const complex<T>&);
    }

### See Also

complex

### Standards Conformance

ISO/IEC 14882:1998 -- International Standard for Information Systems --Programming Language C++, Section 26.2