fabs -- Floating-Point Conversion: Absolute Value

SYNOPSIS

 #include <math.h>

 double fabs(double y);
 

DESCRIPTION

fabs takes the absolute value of a double-precision, floating-point number.

RETURN VALUE

fabs returns the absolute value of the argument y. Both the operand y and the result are of type double.

IMPLEMENTATION

fabs is implemented as a built-in function unless it is undefined by an #undef statement.

EXAMPLE

  #include <math.h>
  #include <stdio.h>

  main()
  {
    double a, b, c;

    puts("Enter values for a & b");
    scanf("%lf %lf", &a, &b);
    c = fabs(a-b);
    printf("The absolute value of their difference = %f", c );
  }

 

RELATED FUNCTIONS

abs, labs

SEE ALSO

Mathematical Functions

Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.