The absolute value of a complex number is its magnitude (or modulus), defined as the theoretical distance between the coordinates (real,imag) of x and (0,0) (apply pythagorean theorem).
This function overloads cstdlib's abs and cmath's abs functions.
Parameters
- x
- Complex value.
Return value
Absolute value of x.T is x's complex template type (i.e., its value type).
Example
| 1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
Output:
The absolute value of (3,4) is 5 |
See also
| arg | Return phase angle of complex (function template) |
| polar | Return complex from polar components (function tempalte) |
| abs (cstdlib) | Absolute value (function) |
