CodeCogs - An iteractive open source Numerical library Welcome... Login
CodeCogs
shopping cart
OSXWindowsLinux
Search CodeCogs
Numerical Pages

Valid RSS

CMath.h

fabs

About | FAQ | Contact
About FAQ Contact

Floating-point absolute value function

viewed 24086 times


+View other versions (2)
Contents -

Interface

#include <math.h>
double fabs (double x)
long fabsl (long double x)
float fabsf (float x)

Description

The fabs functions compute the absolute value of a floating-point number x, which is given by:
Example 1:
#include <stdio.h>
#include <math.h>
 
int main(void)
{
  float number = -1234.0;
  printf("number: %.2f   absolute value: %.2f\n", number, fabs(number));
  return 0;
}
Output:
number: -1234.00   absolute value: 1234.00

Special Values

fabs ( ±0 ) returns 0.
fabs ( ±∞ ) returns +∞.

See Also

abs, ceil, floor

Standards

The fabs functions conform to ISO/IEC 9899:1999(E).
Last Modified: 2009-04-22 22:59:46     Page Rendered: 2010-03-12 10:43:22

Page Comments

Format Excel Equations

  You must login to leave a messge


Valid CSS!   Valid XHTML 1.0 Transitional