Translations of this page?:

C++ Complex Numbers

The complex class provides a useful way to deal with complex numbers. It is defined as a basic template class in the std namespace in the <complex> header file.

 template<typename Num>
 struct complex;

The type parameter Num is the type that is used for each of the real and imaginary components of the complex number. It must be one of: float, double, or long double.

Constructorscreate complex numbers from the real and imaginary parts or other complex numbers
Operatorsarithmetic of complex numbers, equality of complex numbers, IO of complex numbers
absabsolute value of a complex number
argargument (angle) of a complex number
conjconjugate of a complex number
coscosine of a complex number
coshhyperbolic cosine of a complex number
expexponential of a complex number
imagimaginary part of a complex number
lognatural logarithm of a complex number
log10base-10 logarithm of a complex number
normsquare of the absolute value of a complex number
polarconstructs a complex number from polar coordinates
powraising a complex number to a power, raising to a complex number power, or both
realreal part of a complex number
sinsine of a complex number
sinhhyperbolic sine of a complex number
sqrtsquare root of a complex number
tantangent of a complex number
tanhhyperbolic tangent of a complex number
 
• • • IndexRecent changesRSScc