Name

fabs function — Computes absolute value

Synopsis

float fabs(float x)
double fabs(double x)
long double fabs(long double x)

The fabs function returns the absolute value of its argument: if x < 0, it returns -x; otherwise, it returns x.

The fabs function is the same as abs for floating-point numbers. It exists only for compatibility with C.