cc [ flags ] -I/usr/local/include file(s) -L/usr/local/lib -lmcw [ ... ] #include <mathcw.h> #include <cxcw.h> extern void cxlogf (cx_float result, cx_float z); extern void cxlog (cx_double result, cx_double z); extern void cxlogl (cx_long_double result, cx_long_double z); extern void cxlogw (cx_float80 result, cx_float80 z); extern void cxlogq (cx_float128 result, cx_float128 z); extern void cxlogll (cx_long_long_double result, cx_long_long_double z); extern void cxlogdf (cx_decimal_float result, cx_decimal_float z); extern void cxlogd (cx_decimal_double result, cx_decimal_double z); extern void cxlogdl (cx_decimal_long_double result, cx_decimal_long_double z); extern void cxlogdll (cx_decimal_long_long_double result, cx_decimal_long_long_double z);
NB: Functions with prototypes containing underscores in type names may be available only with certain extended compilers.
If the argument in Cartesian form is z = x + y I, where x and y are real, then in polar form, z = r exp(t I), where r = |z| = cabs(z) = hypot(x, y) and t = carg(z) = atan2(y, x). We then have clog(z) = clog(r exp(t I)) = log(r) + t I. Accuracy of the complex logarithm function then depends on that of three real functions.
The cx family of functions provide limited support for complex arithmetic when compiler or language support for a complex type is lacking.