double abs (double x);
float abs (float x);
long double abs (long double x);
double abs (T x); // additional overloads for integral types
Compute absolute value
Returns the absolute value of x: |x|.
These convenience abs overloads are exclusive of C++. In C, abs is only declared in <stdlib.h> (and operates on int values).
Since C++11, additional overloads are provided in this header (<cmath>) for the integral types: These overloads effectively cast x to a double before calculations (defined for T being any integral type).