Keywords: ISO C++, library

Chapter 12. Numerics
Prev | Part II. Standard Contents | Next

## Chapter 12. Numerics

## Complex

### complex Processing

Using `complex<>` becomes even more comple- er, sorry, complicated, with the not-quite-gratuitously-incompatible addition of complex types to the C language. David Tribble has compiled a list of C++98 and C99 conflict points; his description of C's new type versus those of C++ and how to get them playing together nicely is here.

`complex<>` is intended to be instantiated with a floating-point type. As long as you meet that and some other basic requirements, then the resulting instantiation has all of the usual math operators defined, as well as definitions of `op<<` and `op>>` that work with iostreams: `op<<` prints `(u,v)` and `op>>` can read `u`, `(u)`, and `(u,v)`.

As an extension to C++11 and for increased compatibility with C, `<complex.h>` includes both `<complex>` and the C99 `<complex.h>` (if the C library provides it).

Prev | Up | Next
Chapter 11. Algorithms | Home | Generalized Operations