fabs, fabsl

From RAD Studio
Jump to: navigation, search

Go Up to math.h Index


Header File

math.h

Category

Math Routines

Prototype

double fabs(double x);

long double fabsl(long double x);

Description

Returns the absolute value of a floating-point number.

fabs calculates the absolute value of x, a double. fabsl is the long double version; it takes a long double argument and returns a long double result.

Return Value

fabs and fabsl return the absolute value of x.

Example

#include <stdio.h>
#include <math.h>
int main(void)
{
   float  number = -1234.0;

   printf("number: %f  absolute value: %f\n", number, fabs(number));
   return 0;
}

Portability

POSIX Win32 ANSI C ANSI C++

fabs

+

+

+

+

fabsl

+

+

+