The correct overloads are guaranteed to be present in <cmath>
/<cstdlib>
:
C++11, [c.math]:
In addition to the
int
versions of certain math functions in<cstdlib>
, C++ addslong
andlong long
overloaded versions of these functions, with the same semantics.The added signatures are:
long abs(long); // labs() long long abs(long long); // llabs()
[...]
In addition to the
double
versions of the math functions in<cmath>
, overloaded versions of these functions, with the same semantics. C++ addsfloat
andlong double
overloaded versions of these functions, with the same semantics.float abs(float); long double abs(long double);
So you should just make sure to include correctly <cstdlib>
(int
, long
, long long
overloads)/<cmath>
(double
, float
, long double
overloads).