C Reference function cos()

Usage of cos():

double cos(double x);


The value of x has no range.

Return value:

The returned value is in the range of -1 to +1 (inclusive).

Source code example of cos():


	#define PI 3.14159265

		double input, output;
		input = 60.0;
		output = cos (input*PI/180);
		printf ("Cosine of %lf degrees is %lf.\n", input, output );
		return 0;

Output of the cos example program above:

	Cosine of 60.000000 degrees is 0.500000

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: