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. You can leave a response, or trackback from your own site. Tweet This! Tweet This! or use to share this post with others.

Leave a Reply: