fabs, fabsl
raw OCR
Returns the absolute value of a floating-point number.
Defined in header <math.h>
Syntax
#include <math.h>
double fabs(double x);
long double fabsKlong double j);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only | |
|---|---|---|---|---|---|
| fobs | ■ | ■ | ■ | ■ | |
| ■ | ■ |
Remarks
tabs 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
tabs and fabsl return the absolute value of x.
See also
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;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Extraction notes
- heading `fobs, fabsl` read as `fabs, fabsl`
Stable link: /3.1/math.h/fabs/
· short form /3.1/fabs/