Skip to content

Latest commit

 

History

History
51 lines (32 loc) · 807 Bytes

088_fabs.asciidoc

File metadata and controls

51 lines (32 loc) · 807 Bytes

fabs

NAME

fabs - absolute value of floating-point number.

SYNOPSIS
#include <math.h>

double fabs(double x);
DESCRIPTION

The fabs function determines the absolute value of the floating-point number val.

Warning
You’ll also need to link the program against the math library (see example below) using the -lm compile/link option.
RETURN VALUE

The fabs function returns the absolute value of val.

SEE ALSO

abs, cabs, labs

EXAMPLE
link:src/fabs.c[role=include]
OUTPUT
$ gcc -Wall -lm fabs.c
$ ./a.out
fabs(10.200000) = 10.200000
fabs(-3.600000) = 3.600000