C Reference function fabs()

Usage of fabs():

double fabs(double x);

Parameters:

There is no range limit on the argument.

Return value:

There is no range limit on the return value.
A negative value becomes positive, positive value is unchanged. The return value is always positive.

Source code example of fabs():


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

	main()
	{
		printf ("Absolute value of 3.51 is %lf\n", fabs(3.51));
		return 0;
	}

Output of the fabs example program above:


	Absolute value of 3.51 is 3.510000

This entry was posted in C Reference math.h Functions. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed. Tweet This! Tweet This! or use to share this post with others.

Comments are closed.