Copyright © 1997 The Open Group

cos - cosine function

`#include <math.h> double cos(double`

x);

Thecos()function computes the cosine ofx, measured in radians.An application wishing to check for error situations should set

errnoto 0 before callingcos(). Iferrnois non-zero on return, or the returned value is NaN, an error has occurred.

Upon successful completion,cos()returns the cosine ofx.If

xis NaN, NaN is returned anderrnomay be set to [EDOM].If

xis ±Inf, either 0 is returned anderrnois set to [EDOM], or NaN is returned anderrnomay be set to [EDOM].If the result underflows, 0 is returned and

errnomay be set to [ERANGE].

Thecos()function may fail if:

- [EDOM]
- The value of
xis NaN orxis ±Inf.- [ERANGE]
- The result underflows.
No other errors will occur.

None.

Thecos()function may lose accuracy when its argument is far from 0.

None.

acos(),isnan(),sin(),tan(),<math.h>.

Derived from Issue 1 of the SVID.

Copyright © 1997 The Open Group

[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]