std::acos,std::acosf,std::acosl (3) - Linux Manuals
std::acos,std::acosf,std::acosl: std::acos,std::acosf,std::acosl
NAME
std::acos,std::acosf,std::acosl - std::acos,std::acosf,std::acosl
Synopsis
Defined in header <cmath>
float acos ( float arg );
float acosf( float arg ); (since C++11)
double acos ( double arg ); (1) (2)
long double acos ( long double arg );
long double acosl( long double arg ); (3) (since C++11)
double acos ( IntegralType arg ); (4) (since C++11)
1-3) Computes the principal value of the arc cosine of arg.
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 of a floating-point or Integral_type
Return value
If no errors occur, the arc cosine of arg (arccos(arg)) in the range [0 , π], is returned.
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.
Domain error occurs if arg is outside the range [-1.0, 1.0]
If the implementation supports IEEE floating-point arithmetic (IEC 60559),
* If the argument is +1, the value +0 is returned.
* If |arg| > 1, a domain error occurs and NaN is returned.
* if the argument is NaN, NaN is returned
Example
// Run this code
Output:
See also
asin
asinf
asinl computes arc sine (arcsin(x))
(C++11)
(C++11)
atan
atanf
atanl computes arc tangent (arctan(x))
(C++11)
(C++11)
atan2
atan2f
atan2l arc tangent, using signs to determine quadrants
(C++11)
(C++11)
cos
cosf
cosl computes cosine (cos(x))
(C++11)
(C++11)
acos(std::complex) computes arc cosine of a complex number (arccos(z))
(C++11)
acos(std::valarray) (function template)