Something went wrong. Try again.
Cider Isn't Darwin Emulation, Really
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217.\" Copyright (c) 2006 Apple Computer.\".Dd December 11, 2006.Dt COMPLEX 3.Os.Sh NAME.Nm complex.Nd complex floating-point functions.Sh SYNOPSIS.Fd #include <complex.h>.Sh DESCRIPTIONThe header file complex.h provides function prototypes and macros for working with C99 complexfloating-point values. The functions conform to the ISO/IEC 9899:1999(E) standard. In particular,arguments with infinite real or imaginary parts are regarded as infinities, even if the otherpart is a NaN..Ppcomplex.h defines the macro.Fa complexfor use as a type specifier, and the macro .Fa Ito be the imaginary unit, which can be used to construct complexfloating-point numbers from two real floating-point numbers. For example:.Bd -literal -offset indent#include <complex.h>double complex z = 1.0 + 1.0 * I; // z = 1 + i.Ed.PpEach of the functions that use complex floating-point values are provided in single, double,and extended precision; the double precision prototypes are listed here. The man pages for theindividual functions provide more details on their use, special cases, and prototypes for theirsingle and extended precision versions..PpThe double-precision functions defined in complex.h are:.Pp .Ft double.Fn creal "double complex z".Pp.Ft double.Fn cimag "double complex z".Pp.Fn crealand.Fn cimagtake a complex floating-point number and return its real and imaginary part,respectively, as real floating-point numbers..Pp.Ft double.Fn cabs "double complex z".Pp.Ft double.Fn carg "double complex z".Pp.Fn cabsand.Fn cargtake a complex floating-point number and return its norm and argument (phase angle),respectively, as real floating-point numbers. They are used to convert betweenrectangular and polar coordinates, and are fully specified in terms of real functions:.Bd -literal -offset indentcabs(x + iy) = hypot(x,y).brcarg(x + iy) = atan2(y,x).Ed.Pp.Ft double complex.Fn conj "double complex z".Pp.Fn conjtakes a complex floating-point number and returns its complex conjugate..Pp.Ft double complex.Fn cproj "double complex z".Pp.Fn cprojtakes a complex floating-point number and returns its projection onto theRiemann sphere, as defined in C99. For non-infinite inputs, the return value isequal to the input value..Pp.Ft double complex.Fn csqrt "double complex z".Pp.Fn csqrttakes a complex floating-point number and returns its square root, with a branch cut onthe negative real axis..Pp.Ft double complex.Fn cexp "double complex z".Pp.Ft double complex.Fn clog "double complex z".Pp.Fn cexpand.Fn clogtake a complex floating-point number and return its base-e exponential and logarithm,respectively..Fn cloghas a branch cut on the negative real axis..Pp.Ft double complex.Fn cpow "double complex z" "double complex w".Pp.Fn cpowtakes two complex floating-point numbers, and returns the first raised to the power of the second,with a branch cut for the first parameter along the negative real axis..Pp.Ft double complex.Fn csin "double complex z".Pp.Ft double complex.Fn ccos "double complex z".Pp.Ft double complex.Fn ctan "double complex z".Pp.Fn csin ,.Fn ccos ,and.Fn ctantake a complex floating-point number and return its sine, cosine, and tangent, respectively..Pp.Ft double complex.Fn casin "double complex z".Pp.Ft double complex.Fn cacos "double complex z".Pp.Ft double complex.Fn catan "double complex z".Pp.Fn casin ,.Fn cacos ,and.Fn catantake a complex floating-point number and return its inverse sine, cosine, and tangent, respectively..Pp.Fn casinand.Fn cacoshave branch cuts outside the interval.Bq -1, 1on the real axis,and.Fn catanhas a branch cut outside the interval.Bq -i, ion the imaginary axis..Pp.Ft double complex.Fn csinh "double complex z".Pp.Ft double complex.Fn ccosh "double complex z".Pp.Ft double complex.Fn ctanh "double complex z".Pp.Fn csinh ,.Fn ccosh ,and.Fn ctanhtake a complex floating-point number and return its hyperbolic sine, cosine, and tangent, respectively..Pp.Ft double complex.Fn casinh "double complex z".Pp.Ft double complex.Fn cacosh "double complex z".Pp.Ft double complex.Fn catanh "double complex z".Pp.Fn casinh ,.Fn cacosh ,and.Fn catanhtake a complex floating-point number and return its inverse hyperbolic sine, cosine, and tangent, respectively..Pp.Fn casinhhas a branch cut outside the interval.Bq -i, ion the imaginary axis..Fn cacoshhas a branch cut at values less than 1 on the real axis..Fn catanhhas a branch cut outside the interval.Bq -1, 1on the real axis..Sh NOTENote that the complex math functions are not, in general, equivalent to their real counterparts for inputs on thereal axis. For example, csqrt(-1 + 0i) is 0 + i, whereas sqrt(-1) is NaN..Sh SEE ALSO.Xr cabs 3 ,.Xr cacos 3 ,.Xr cacosh 3 ,.Xr carg 3 ,.Xr casin 3 ,.Xr casinh 3 ,.Xr catan 3 ,.Xr catanh 3 ,.Xr ccos 3 ,.Xr ccosh 3 ,.Xr cexp 3 ,.Xr cimag 3 ,.Xr clog 3 ,.Xr conj 3 ,.Xr cpow 3 ,.Xr cproj 3 ,.Xr creal 3 ,.Xr csin 3 ,.Xr csinh 3 ,.Xr csqrt 3 ,.Xr ctan 3 ,.Xr ctanh 3 ,.Xr math 3.Sh STANDARDSThe <complex.h> functions conform to ISO/IEC 9899:1999(E).