Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

fabs, fabsf, fabsl - Absolutbetrag einer Gleitkommazahl

&pagelevel(4)&pagelevel

Definition

#include <math.h>

double fabs(double x);
float fabsf(float x);
long double fabsl(long double x);

Diese Funktionen berechnen den Absolutbetrag einer Gleitkommazahl x.

Returnwert   Absolutbetrag des Arguments: |x|

Beispiel

Folgendes Programm berechnet den Absolutbetrag einer eingelesenen Gleitkommazahl.

#include <math.h>
#include <stdio.h>
int main(void)
{
   double x;
   printf("Bitte geben Sie eine Gleitkommazahl ein:\n");
   if (scanf("%lf", &x) == 1)
       printf("?%g? = %g\n", x, fabs(x));
   return 0;
}

Siehe auch  abs, cabs, ceil, floor, labs, llabs