The complex arithmetic library defines all the basic arithmetic operators. Specifically, the following operators work in the usual way and with the usual precedence:
+ - / * =
The operator - has its usual binary and unary meanings.
In addition, you can use the following operators in the usual way:
+= -= *= /=
However, these last four operators do not produce values that you can use in expressions. For example, the following does not work:
complex a, b; ... if ((a+=2)==0) {...}; // illegal b = a *= b; // illegal
You can also use the following equality operators in their regular meaning:
== !=
When you mix real and complex numbers in an arithmetic expression, C++ uses the complex operator function and converts the real values to complex values.