# fabsl Function

Calculates the absolute value of a long double precision floating-point value.

Include

<math.h>

Prototype

long double fabsl(long double x);

Argument

 x floating-point value for which to return the absolute value

Return Value

Returns the absolute value of x. A negative number is returned as positive; a positive number is unchanged.

Remarks

No domain or range error will occur.

Example

See the notes at the beginning of this chapter or section for information on using printf() or scanf() (and other functions reading and writing the stdin or stdout streams) in the example code.

#include <math.h>
#include <stdio.h>

int main(void)
{
long double x, y;

x = 1.75;
y = fabsl(x);
printf("The absolute value of  %Lf is  %Lf\n", x, y);

x = -1.5;
y = fabsl(x);
printf("The absolute value of %Lf is  %Lf\n", x, y);
}

Example Output

The absolute value of  1.750000 is  1.750000
The absolute value of -1.500000 is  1.500000