.\" '\" t .\" .\" @(#)cplxexp.3 1.8 00/03/29 SMI; .\" .TH CPLXEXP 3CC4 "07 August 1997" .\" .SH NAME cplxexp, exp, log, log10, pow, sqrt \- functions in the C++ complex number math library .SH SYNOPSIS .LP .nf .ft B #include .sp .5v 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); ... \fI// remainder not shown here\fB }; .ft R .fi .\" .SH DESCRIPTION .LP These functions are versions of the corresponding floating-point math library functions, overloaded for use with complex numbers. .TP .B "complex z = exp(x)" Returns \fBe\fR raised to the \fBx\fR power, where \fBx\fR is a complex number, and \fBe\fR is the base of the natural logarithms. .TP .B "complex z = log(x)" Returns the natural logarithm (base \fBe\fR) of \fBx\fR, where \fBx\fR is a complex number. .TP .B "complex z = log10(x)" Returns the common logarithm (base 10) of \fBx\fR, where \fBx\fR is a complex number. .TP .B "complex z = pow(x, y)" Returns \fBx\fR raised to the \fBy\fR power, where \fBx\fR or \fBy\fR (or both) are complex numbers. The library provides versions of this function optimized for various combinations of integer, floating-point, and complex arguments. .TP .B "complex z = sqrt(x)" Returns the square root of \fBx\fR, where \fBx\fR is a complex number. The real part of the result will be non-negative. .\" .SH "SEE ALSO" .LP .na .BR cplx.intro (3CC4), .BR cartpol (3CC4), .BR cplxerr (3CC4), .BR cplxops (3CC4), .BR cplxtrig (3CC4), .BR intro (2), .I C++ Library Reference Manual, Chapter 2, "The Complex Arithmetic Library." .\" .TZ ???? .ad .\" .SH DIAGNOSTICS .LP .TP .B exp(x) If the real part of \fBx\fR is small enough or the imaginary part is large enough to cause overflow, \fBexp()\fR returns \fB(0,0)\fR. If the real part is large enough to cause overflow, returns a value depending on the sine and cosine of the imaginary part of \fBx\fR: .TS .\"allbox; .\"ccn. .nf .sp 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) .sp .fi .TE In all cases, \fBerrno\fR is set to \fBERANGE\fR (see \fBintro\fR(2)). .TP .B "log(x), log10(x)" If \fBx\fR is \fB(0,0)\fR, returns \fB(\-HUGE_VAL, 0)\fR, sets \fBerrno\fR to \fBEDOM\fR (see \fBintro\fR(2)), and generates a \fBSING\fR error (see \fBcplxerr\fR(3CC4)).