.\" '\" tep .\" to invoke 'tbl', 'eqn', 'pic' in the proper order .\" .\" @(#)cplxops.3 1.6 00/02/18 SMI; .\" .TH CPLXOPS 3CC4 "07 August 1997" .\" .SH NAME cplxops \- arithmetic operator functions in the C++ complex number math library .SH SYNOPSIS .LP .nf .ft B #include .sp .5v class complex { public: friend complex operator- (const complex); .sp .5v friend complex operator+ (const complex, const complex); friend complex operator+ (double, const complex); friend complex operator+ (const complex, double); friend complex operator- (const complex, const complex); friend complex operator- (double, const complex); friend complex operator- (const complex, double); friend complex operator* (const complex, const complex); friend complex operator* (const complex, double); friend complex operator* (double, const complex); friend complex operator/ (const complex, const complex); friend complex operator/ (const complex, double); friend complex operator/ (double, const complex); .sp .5v friend int operator== (const complex, const complex); friend int operator!= (const complex, const complex); .sp .5v void operator+= (const complex); void operator+= (double); void operator-= (const complex); void operator-= (double); void operator*= (const complex); void operator*= (double); void operator/= (const complex); void operator/= (double); .sp .5v ... \fI// remainder not shown here\fB }; .ft R .fi .\" .SH DESCRIPTION .LP These functions are versions of the normal arithmetic operators overloaded for use with complex numbers. .SS "Unary minus" .TP .B "complex z = \- x" Returns the negative of complex \fBx\fR. .SS "Binary arithmetic" .TP .B "complex z = x + y" Returns the sum of \fBx\fR and \fBy\fR, where one or both are complex. The library provides versions of this function optimized for combinations of floating-point and complex arguments. .ne 4 .TP .B "complex z = x \- y" Returns the difference of \fBx\fR and \fBy\fR, where one or both are complex. The library provides versions of this function optimized for combinations of floating-point and complex arguments. .TP .B "complex z = x * y" Returns the product of \fBx\fR and \fBy\fR, where one or both are complex. The library provides versions of this function optimized for combinations of floating-point and complex arguments. .TP .B "complex z = x / y" Returns the quotient of \fBx\fR and \fBy\fR, where one or both are complex. The library provides versions of this function optimized for combinations of floating-point and complex arguments. .SS Comparison .LP Complex numbers are not well-ordered, so only equality can be tested. .TP .B "x == y" Returns 1 if \fBx\fR and \fBy\fR (both complex) are equal, 0 otherwise. .TP .B "x != y" Returns 0 if \fBx\fR and \fBy\fR (both complex) are equal, 1 otherwise. .SS Assignment .LP The compiler-generated default assignment operator, .BR "complex& operator=(const complex&)" , is appropriate for this type, so it is not redefined by the class. Note: The compound assignment operators do not return a value, and so cannot be used in larger expressions. For example, the expression .ti +.5i .B "z = ( x += y );" .br is valid if \fBx\fR is an integer or floating-point type, but will not compile if \fBx\fR is complex. .TP .B "x += y" Complex \fBx\fR is incremented by the value of \fBy\fR. The library provides versions of this function optimized for floating-point and complex right-hand arguments. .TP .B "x \-= y" Complex \fBx\fR is decremented by the value of \fBy\fR. The library provides versions of this function optimized for floating-point and complex right-hand arguments. .TP .B "x *= y" Complex \fBx\fR is assigned the value of itself multiplied by the value of \fBy\fR. The library provides versions of this function optimized for floating-point and complex right-hand arguments. .TP .B "x /= y" Complex \fBx\fR is assigned the value of itself divided by the value of \fBy\fR. The library provides versions of this function optimized for floating-point and complex right-hand arguments. .\" .SH "SEE ALSO" .LP .na .BR cplx.intro (3CC4), .BR cartpol (3CC4), .BR cplxerr (3CC4), .BR cplxexp (3CC4), .BR cplxtrig (3CC4) .LP .I C++ Library Reference Chapter 2, "The Complex Arithmetic Library." .\" .TZ ???? .ad .\"