NAME

complex.h - complex arithmetic

SYNOPSIS

#include<complex.h>

DESCRIPTION

The <complex.h> header shall define the following macros:
complex
Expands to _Complex.
_Complex_I
Expands to a constant expression of type constfloat_Complex,
with the value of the imaginary unit (that is, a number i such
that i**2=-1).
imaginary
Expands to _Imaginary.
_Imaginary_I
Expands to a constant expression of type constfloat_Imaginary
with the value of the imaginary unit.
I Expands to either _Imaginary_I or _Complex_I. If _Imaginary_I is
not defined, I expands to _Complex_I.
The macros imaginary and _Imaginary_I shall be defined if and only if
the implementation supports imaginary types.
An application may undefine and then, perhaps, redefine the complex,
imaginary, and I macros.
The following shall be declared as functions and may also be defined as
macros. Function prototypes shall be provided.
doublecabs(doublecomplex);floatcabsf(floatcomplex);longdoublecabsl(longdoublecomplex);doublecomplexcacos(doublecomplex);floatcomplexcacosf(floatcomplex);doublecomplexcacosh(doublecomplex);floatcomplexcacoshf(floatcomplex);longdoublecomplexcacoshl(longdoublecomplex);longdoublecomplexcacosl(longdoublecomplex);doublecarg(doublecomplex);floatcargf(floatcomplex);longdoublecargl(longdoublecomplex);doublecomplexcasin(doublecomplex);floatcomplexcasinf(floatcomplex);doublecomplexcasinh(doublecomplex);floatcomplexcasinhf(floatcomplex);longdoublecomplexcasinhl(longdoublecomplex);longdoublecomplexcasinl(longdoublecomplex);doublecomplexcatan(doublecomplex);floatcomplexcatanf(floatcomplex);doublecomplexcatanh(doublecomplex);floatcomplexcatanhf(floatcomplex);longdoublecomplexcatanhl(longdoublecomplex);longdoublecomplexcatanl(longdoublecomplex);doublecomplexccos(doublecomplex);floatcomplexccosf(floatcomplex);doublecomplexccosh(doublecomplex);floatcomplexccoshf(floatcomplex);longdoublecomplexccoshl(longdoublecomplex);longdoublecomplexccosl(longdoublecomplex);doublecomplexcexp(doublecomplex);floatcomplexcexpf(floatcomplex);longdoublecomplexcexpl(longdoublecomplex);doublecimag(doublecomplex);floatcimagf(floatcomplex);longdoublecimagl(longdoublecomplex);doublecomplexclog(doublecomplex);floatcomplexclogf(floatcomplex);longdoublecomplexclogl(longdoublecomplex);doublecomplexconj(doublecomplex);floatcomplexconjf(floatcomplex);longdoublecomplexconjl(longdoublecomplex);doublecomplexcpow(doublecomplex,doublecomplex);floatcomplexcpowf(floatcomplex,floatcomplex);longdoublecomplexcpowl(longdoublecomplex,longdoublecomplex);doublecomplexcproj(doublecomplex);floatcomplexcprojf(floatcomplex);longdoublecomplexcprojl(longdoublecomplex);doublecreal(doublecomplex);floatcrealf(floatcomplex);longdoublecreall(longdoublecomplex);doublecomplexcsin(doublecomplex);floatcomplexcsinf(floatcomplex);doublecomplexcsinh(doublecomplex);floatcomplexcsinhf(floatcomplex);longdoublecomplexcsinhl(longdoublecomplex);longdoublecomplexcsinl(longdoublecomplex);doublecomplexcsqrt(doublecomplex);floatcomplexcsqrtf(floatcomplex);longdoublecomplexcsqrtl(longdoublecomplex);doublecomplexctan(doublecomplex);floatcomplexctanf(floatcomplex);doublecomplexctanh(doublecomplex);floatcomplexctanhf(floatcomplex);longdoublecomplexctanhl(longdoublecomplex);longdoublecomplexctanl(longdoublecomplex);Thefollowingsectionsareinformative.

APPLICATIONUSAGE

Values are interpreted as radians, not degrees.

RATIONALE

The choice of I instead of i for the imaginary unit concedes to the
widespread use of the identifier i for other purposes. The application
can use a different identifier, say j, for the imaginary unit by
following the inclusion of the <complex.h> header with:
#undefI#definej_Imaginary_I
An I suffix to designate imaginary constants is not required, as
multiplication by I provides a sufficiently convenient and more
generally useful notation for imaginary terms. The corresponding real
type for the imaginary unit is float, so that use of I for algorithmic
or notational convenience will not result in widening types.
On systems with imaginary types, the application has the ability to
control whether use of the macro I introduces an imaginary type, by
explicitly defining I to be _Imaginary_I or _Complex_I. Disallowing
imaginary types is useful for some applications intended to run on
implementations without support for such types.
The macro _Imaginary_I provides a test for whether imaginary types are
supported.
The cis() function (cos(x) + I*sin(x)) was considered but rejected
because its implementation is easy and straightforward, even though
some implementations could compute sine and cosine more efficiently in
tandem.

FUTUREDIRECTIONS

The following function names and the same names suffixed with f or l
are reserved for future use, and may be added to the declarations in
the <complex.h> header.
cerf() cexpm1() clog2()
cerfc() clog10() clgamma()
cexp2() clog1p() ctgamma()

COPYRIGHT

Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the
event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online
at http://www.opengroup.org/unix/online.html .