CPLXEXP(3C++)

NAME
cplxexp, exp, log, log10, pow, sqrt - functions in the C++ complex number math library

SYNOPSIS

#include <complex.h>

class complex {
public:
	friend complex exp(const complex);
	friend complex log(const complex);
	friend complex log10(const complex);
	friend complex pow(double base, const complex exp);
	friend complex pow(const complex base, int exp);
	friend complex pow(const complex base, double exp);
	friend complex pow(const complex base, const complex exp);
	friend complex sqrt(const complex);
	... // remainder not shown here
};

DESCRIPTION

These functions are versions of the corresponding floating-point math library functions, overloaded for use with complex numbers.

complex z = exp(x)
    Returns e raised to the x power, where x is a complex number, and e is the base of the natural logarithms.

complex z = log(x)
    Returns the natural logarithm (base e) of x, where x is a complex number.

complex z = log10(x)
    Returns the common logarithm (base 10) of x, where x is a complex number.

complex z = pow(x, y)
    Returns x raised to the y power, where x or y (or both) are complex numbers. The library provides versions of this function optimized for various combinations of integer, floating-point, and complex arguments.

complex z = sqrt(x)
    Returns the square root of x, where x is a complex number. The real part of the result will be non-negative.

SEE ALSO

cplx.intro(3C++), cartpol(3C++), cplxerr(3C++), cplxops(3C++), cplxtrig(3C++), intro(2), Complex Tutorial .

DIAGNOSTICS

exp(x)
    If the real part of x is small enough or the imaginary part is large enough to cause overflow, exp() returns (0,0). If the real part is large enough to cause overflow, returns a value depending on the sine and cosine of the imaginary part of x:
    x.imag() | x.imag() | returned value
    sin>=0 | cos>=0 | (HUGE_VAL, HUGE_VAL)
    sin< 0 | cos>=0 | (HUGE_VAL, -HUGE_VAL)
    sin>=0 | cos< 0 | (-HUGE_VAL, HUGE_VAL)
    sin< 0 | cos< 0 | (-HUGE_VAL, -HUGE_VAL)
    In all cases, errno is set to ERANGE (see intro(2)).

log(x), log10(x)
    If x is (0,0), returns (-HUGE_VAL, 0), sets errno to EDOM (see intro(2)), and generates a SING error (see cplxerr(3C++)).