Keil Logo

fabs

Summary
#include <math.h>

double fabs (
  double val);   /* number to take absolute value of */
Description

The fabs function determines the absolute value of the floating-point number val.

Return Value

The fabs function returns the absolute value of val.

See Also

abs, labs

Example
#include <math.h>
#include <stdio.h> /* for printf */

void tst_fabs (void) {
  float x;
  float y;

  x = 10.2;
  y = fabs (x);
  printf ("FABS(%f) = %f\n", x, y);

  x = -3.6;
  y = fabs (x);
  printf ("FABS(%f) = %f\n", x, y);
}
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.