Programming in C

(Barry) #1
488 Appendix B The Standard C Library

Complex Arithmetic

This header file <complex.h>defines various type definitions and functions for working
with complex numbers. Listed next are several macros that are defined in this file, fol-
lowed by functions for performing complex arithmetic.
Define Meaning
complex Substitute name for the type _Complex
_Complex_I Macro used for specifying the imaginary part of a complex
number (for example,4 + 6.2 * _Complex_Ispecifies 4 +
6.2i)
imaginary Substitute name for the type _Imaginary; only defined if the
implementation supports imaginary types
_Imaginary_I Macro used to specify the imaginary part of an imaginary
number
In the list of functions that follows,yand zare of type double complex,xis of type
double,and nis an int.
double complex cabs (z)^2
Returns the complex absolute value of z.
double complex cacos (z)
Returns the complex arc cosine of z.
double complex cacosh (z)
Returns the complex arc hyperbolic cosine of z.
double carg (z)
Returns the phase angle of z.
double complex casin (z)
Returns the complex arc sine of z.
double complex casinh (z)
Returns the complex arc hyperbolic sine of z.

2.The complex math library contains float complex, double complex, and long double complex
versions of the functions that take and return float complex, double complex, and long double
complex values.The double complex versions are summarized here.The float complex versions
have the same name with an fon the end (e.g.cacosf).The long double versions have an lon
the end instead (e.g.cacosl).

21 0672326663 AppB 6/10/04 2:03 PM Page 488

Free download pdf