cos()

Computes the cosine.

  #include <math.h>
  
  double cos(double x);
  
  float cosf(float x);
  
  long double cosl(long double x);    
Parameter

x

A value from which to compute.

Remarks

These functions return the cosine of x, which is measured in radians.

This facility may not be available on configurations of the EWL that run on platforms that do not have floating-point math capabilities.

Listing: Example of cos() Usage

#include <math.h>

#include <stdio.h>

int main(void)

{

double x = 0.0;

printf("The cosine of %f is %f.\n", x, cos(x));

return 0;

}

Output:

The cosine of 0.000000 is 1.000000.