NAME cplxops - arithmetic operator functions in the C++ complex number math library SYNOPSIS #include <complex.h> class complex { public: friend complex operator- (const complex); 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); friend int operator== (const complex, const complex); friend int operator!= (const complex, const complex); 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); ... // remainder not shown here }; DESCRIPTION These functions are versions of the normal arithmetic opera- tors overloaded for use with complex numbers. Unary minus complex z = - x Returns the negative of complex x. Binary arithmetic complex z = x + y Returns the sum of x and y, where one or both are com- plex. The library provides versions of this function optimized for combinations of floating-point and com- plex arguments. complex z = x - y Returns the difference of x and y, where one or both are complex. The library provides versions of this function optimized for combinations of floating-point and complex arguments. complex z = x * y Returns the product of x and y, where one or both are complex. The library provides versions of this func- tion optimized for combinations of floating-point and complex arguments. complex z = x / y Returns the quotient of x and y, where one or both are complex. The library provides versions of this func- tion optimized for combinations of floating-point and complex arguments. Comparison Complex numbers are not well-ordered, so only equality can be tested. x == y Returns 1 if x and y (both complex) are equal, 0 other- wise. x != y Returns 0 if x and y (both complex) are equal, 1 other- wise. Assignment The compiler-generated default assignment operator, 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 z = ( x += y ); is valid if x is an integer or floating-point type, but will not compile if x is complex. x += y Complex x is incremented by the value of y. The library provides versions of this function optimized for floating-point and complex right-hand arguments. x -= y Complex x is decremented by the value of y. The library provides versions of this function optimized for floating-point and complex right-hand arguments. x *= y Complex x is assigned the value of itself multiplied by the value of y. The library provides versions of this function optimized for floating-point and complex right-hand arguments. x /= y Complex x is assigned the value of itself divided by the value of y. The library provides versions of this function optimized for floating-point and complex right-hand arguments. SEE ALSO cplx.intro(3C++), cartpol(3C++), cplxerr(3C++), cplxexp(3C++), cplxtrig(3C++) C++ Library Reference Manual, Chapter 3, "The Complex Arith- metic Library."
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |