fabs()
Prototype: double fabs(double number);
Header File: math.h (C) or cmath (C++)
Explanation: This function returns the absolute value of a number. It will not truncate the decimal like abs() will, so it is better for certain calculations.
//Example outputs absolute value of -12.3 with fabs and abs
#include
#include
int main()
{
cout<<"Abs(-12.3)="<cout<<"Fabs(-12.3)="< }
Categories: Functions List, Resources