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.
See Also
abs function, abs
function in <cstdlib>
Get C++ In a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.