|
|
#include <complex.h>class complex;
#include
file
<complex.h>.
When compiling programs using the complex library,
users must provide the -lm options on the CC
command line to link the math library.
The Complex Mathematics library implements the data type of
complex numbers as a class, complex
.
It overloads the standard input, output, arithmetic, assignment, and
comparison operators, discussed in the manual pages for
cplxops(C++).
It also overloads the standard exponential, logarithm, power,
and square root functions, discussed in
cplxexp(C++),
and the trigonometric functions of
sine, cosine, hyperbolic sine, and hyperbolic cosine,
discussed in
cplxtrig(C++),
for the class complex
.
Routines for converting between Cartesian and polar coordinate
systems are discussed in
cartpol(C++).
Error handling is described in
cplxerr(C++).
(0, 0)
, (0, ±HUGE)
, (±HUGE, 0),
or (±HUGE, ±HUGE)
,
when the function is undefined for the
given arguments or when the value is not representable.
(HUGE
is the largest-magnitude single-precision floating-point number and
is defined in the file <math.h>.
The header file <math.h> is included
in the file <complex.h>.)
In these cases, the external variable errno
(see
Intro(S))
is set to the value EDOM or ERANGE.
Complex arithmetic in C++ by Rose, L. and Stroustrup, B.
Chapter 1 of the C++ Library Manual.