function
<cmath> <ctgmath>
fabsdouble fabs (double x); float fabsf (float x);long double fabsl (long double x);
double fabs (double x); float fabs (float x);long double fabs (long double x);
double fabs (double x); float fabs (float x);long double fabs (long double x); double fabs (T x); // additional overloads for integral types
Compute absolute value
Returns the absolute value of x: |x|.Header
<tgmath.h>provides a type-generic macro version of this function.
are provided in this header (
<cmath>
) for the
integral types: These overloads effectively cast
xto a
double
(defined for
Tbeing any
integral type).
1
2
3
4
5
6
7
8
9
10
/* fabs example */
#include <stdio.h> /* printf */
#include <math.h> /* fabs */
int main ()
{
printf ("The absolute value of 3.1416 is %f\n", fabs (3.1416) );
printf ("The absolute value of -10.6 is %f\n", fabs (-10.6) );
return 0;
}
The absolute value of 3.1416 is 3.141600 The absolute value of -10.6 is 10.600000
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4