|
|
||||
|
|
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:
//Example outputs absolute value of -12.3 with fabs and abs
#include <cmath>
#include <iostream>
int main()
{
cout<<"Abs(-12.3)="<<abs(-12.3)<<endl;
cout<<"Fabs(-12.3)="<<fabs(-12.3);
}
Other Functions
----- |
|
||