Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
div
eof
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

cos, cosf, cosh, coshf 

Calculate the cosine (cos or cosf) or hyperbolic cosine (cosh or coshf).


double cos( 
   double x 
);
float cos(
   float x 
);  // C++ only
long double cos(
   long double x
);  // C++ only
float cosf( 
   float x 
);
double cosh( 
   double x 
);
float cosh(
   float x 
);  // C++ only
long double cosh(
   long double x
);  // C++ only
float coshf(
   float x 
);

Parameters

x

Angle in radians.

The cosine or hyperbolic cosine of x. If x is greater than or equal to 263, or less than or equal to –263, a loss of significance in the result of a call to cos occurs.

If the result is too large in a cosh or coshf call, the function returns HUGE_VAL and sets errno to ERANGE, by default.

Input SEH Exception Matherr Exception

± QNAN,IND

none

_DOMAIN

± ∞ (cosf, cos)

INVALID

_DOMAIN

x ≥ 7.104760e+002 (cosh, coshf)

INEXACT+OVERFLOW

OVERFLOW

C++ allows overloading, so you can call overloads of cos and cosh. In a C program, cos and cosh always take and return a double.

Routine Required header Compatibility

cos, cosh, cosf, coshf

<math.h>

ANSI, Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition, Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003

For additional compatibility information, see Compatibility in the Introduction.

See the example in sin, sinf, sinh, sinhf.

Community Additions

ADD
Show:
© 2015 Microsoft