In C++, this function is overloaded in <cstdlib>, <complex> and <valarray> (see cstdlib abs, complex abs and valarray abs).
Parameters
- x
- Floating point value.
Return Value
The absolute value of x.Portability
These overloads of abs are only available in C++.In C, only the cstdlib version of exists (see cstdlib abs) - fabs can be used instead.
Example
| 1 2 3 4 5 6 7 8 9 10 11 |
|
Output:
The absolute value of 3.1416 is 3.1416 The absolute value of -10.6 is 10.6 |
See also
| abs | Absolute value (function) |
| fabs | Compute absolute value (function) |
| labs | Absolute value (function) |
