CodeCogs - An iteractive open source Numerical library Welcome... Login
CodeCogs
shopping cart
OSXWindowsLinux
Search CodeCogs
Numerical Pages

Valid RSS

CMath.h

cos

About | FAQ | Contact
About FAQ Contact

Cosine function

viewed 31488 times


+View other versions (3)
Contents -

Interface

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

#include <complex.h>
double complex ccos (double complex z)
long double complex ccosl (long double complex z)
float complex ccosf (float complex z)

Description

The cos function computes the cosine of x (measured in radians). It returns a value in the range of -1 to 1.

The complex cosine is defined by
Example 1:
#include <stdio.h>
#include <math.h>
 
int main()
{
  double x = 1.047198;
  double result = cos(x);
  printf("The cosine of %lf is %lf\n", x, result);
  return 0;
}

Output:
The cosine of 1.047198 is 0.500000

Special Values

cos ( 0 ) returns 1.
cos ( ) returns a NaN and raises the invalid floating-point exception.

See Also

sin, tan, asin, acos, atan, atan2, sinh, cosh, tanh

Standards

The cos function conforms to ISO/IEC 9899:1999(E).
Last Modified: 2009-11-01 08:45:49     Page Rendered: 2010-03-12 13:20:42

Page Comments

Format Excel Equations

  You must login to leave a messge


Valid CSS!   Valid XHTML 1.0 Transitional