Man Linux: Main Page and Category List

complex.h - complex arithmetic

#include<complex.h>

The<complex.h>header shall define the following macros: complex Expands to_Complex. _Complex_I Expands to a constant expression of typeconstfloat_Complex, with the value of the imaginary unit (that is, a numberisuch thati**2=-1). imaginary Expands to_Imaginary. _Imaginary_I Expands to a constant expression of typeconstfloat_Imaginarywith 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.

Values are interpreted as radians, not degrees.

The choice ofIinstead ofifor the imaginary unit concedes to the widespread use of the identifierifor other purposes. The application can use a different identifier, sayj, for the imaginary unit by following the inclusion of the<complex.h>header with:#undefI#definej_Imaginary_IAnIsuffix to designate imaginary constants is not required, as multiplication byIprovides a sufficiently convenient and more generally useful notation for imaginary terms. The corresponding real type for the imaginary unit isfloat, so that use ofIfor 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. Thecis() 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.

The following function names and the same names suffixed withforlare 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()

The System Interfaces volume of IEEE Std 1003.1-2001,cabs(),cacos(),cacosh(),carg(),casin(),casinh(),catan(),catanh(),ccos(),ccosh(),cexp(),cimag(),clog(),conj(),cpow(),cproj(),creal(),csin(),csinh(),csqrt(),ctan(),ctanh()

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 .