acos. McGraw-Hill The Complete Reference Fourth Edition
Quảng cáo
Quảng cáo
738
C + + : T h e C o m p l e t e R e f e r e n c e
acos
T he standard function library contains several mathematical functions, which fall into the following categories:
■ Trigonometric functions
■ Hyperbolic functions
■ Exponential and logarithmic functions
■ Miscellaneous functions
All the math functions require the header <cmath>. (C programs must use the header file math.h.) In addition to declaring the math functions, this header defines the macro called HUGE_VAL. The macros EDOM and ERANGE are also used by the math functions. These macros are defined in the header <cerrno> (or the file errno.h).
If an argument to a math function is not in the domain for which it is defined, an implementation-defined value is returned, and the built-in global integer variable
errno
is set equal to EDOM. If a routine produces a result that is too large to be represented, an overflow occurs. This causes the routine to return HUGE_VAL, and
errno
is set to ERANGE, indicating a range error. If an underflow happens, the function returns zero and sets errno to ERANGE.
All angles are in radians.
Originally, the mathematical functions were specified as operating on values of type
double
, but Standard C++ added overloaded versions to explicitly accommodate values of type float and long double. The operation of the functions is otherwise unchanged.
#include <cmath> float acos(float arg); double acos(double arg); long double acos(long double arg);
asin
The acos( ) function returns the arc cosine of arg. The argument to acos( ) must be in the range –1 to 1; otherwise a domain error will occur.
Related functions are asin( ), atan( ), atan2( ), sin( ), cos( ), tan( ), sinh( ), cosh( ), and tanh( ).
#include <cmath> float asin(float arg);
Tải xuống
Quảng cáo