26 Numerics library [numerics]

26.8 Mathematical functions for floating-point types [c.math]

26.8.2 Absolute values [c.math.abs]

[Note
:
The headers <cstdlib> ([cstdlib.syn]) and <cmath> ([cmath.syn]) declare the functions described in this subclause.
— end note
]
int abs(int j); long int abs(long int j); long long int abs(long long int j); float abs(float j); double abs(double j); long double abs(long double j);
Effects: The abs functions have the semantics specified in the C standard library for the functions abs, labs, llabs, fabsf, fabs, and fabsl.
Remarks: If abs() is called with an argument of type X for which is_­unsigned_­v<X> is true and if X cannot be converted to int by integral promotion, the program is ill-formed.
[Note
:
Arguments that can be promoted to int are permitted for compatibility with C.
— end note
]
See also: ISO C 7.12.7.2, 7.22.6.1