std::cos
From cppreference.com
Defined in header <cmath>
|
||
float cos( float arg ); |
(1) | |
double cos( double arg ); |
(2) | |
long double cos( long double arg ); |
(3) | |
double cos( Integral arg ); |
(4) | (since C++11) |
Computes the cosine of arg
(measured in radians).
4) A set of overloads or a function template accepting an argument of any integral type. Equivalent to 2) (the argument is cast to double).
Parameters
arg | - | value representing angle in radians, of a floating-point or Integral type |
Return value
If no errors occur, the cosine of arg
(cos(arg)) in the range [-1 ; +1], is returned.
The result may have little or no significance if the magnitude of |
(until C++11) |
If a domain error occurs, an implementation-defined value is returned (NaN where supported)
If a range error occurs due to underflow, the correct result (after rounding) is returned.
Error handling
Errors are reported as specified in math_errhandling
If the implementation supports IEEE floating-point arithmetic (IEC 60559),
- if the argument is ±0, the result is 1.0
- if the argument is ±∞, NaN is returned and FE_INVALID is raised
- if the argument is NaN, NaN is returned
Notes
The case where the argument is infinite is not specified to be a domain error in C, but it is defined as a domain error in POSIX