##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::cos

From cppreference.com
< cpp‎ | numeric‎ | math

Defined in header `<cmath>` |  |
float cos( float arg ); |  |
double cos( double arg ); |  |
long double cos( long double arg ); |  |
double cos( Integral arg ); |  | (since C++11)

Computes cosine of `arg`.

### [edit] Parameters

arg | - | value representing angle in radians, of a floating-point or Integral type

### [edit] Return value

Cosine of `arg` in the range `[-1.0 ; 1.0]`.

Domain error occurs if `arg` is infinite. NAN is returned in that case.

### [edit] See also

sin | computes sine (sin(x)) (function) [edit]
tan | computes tangent (tan(x)) (function) [edit]
acos | computes arc cosine (arccos(x)) (function) [edit]
cos(std::complex) | computes cosine of a complex number (cos(z)) (function template) [edit]
cos(std::valarray) | applies the function std::cos to each element of valarray (function template) [edit]
C documentation for cos

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/numeric/math/cos&oldid=67134"