Export (0) Print
Expand All
div
Expand Minimize
1 out of 1 rated this helpful - Rate this topic

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 
);

Parameter

x
Angle in radians.

Return Value

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

Remarks

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.

Requirements

Routine Required header Compatibility
cos, cosh, cosf, coshf <math.h> ANSI, Win 98, Win Me, Win NT, Win 2000, Win XP

For additional compatibility information, see Compatibility in the Introduction.

Libraries

All versions of the C run-time libraries.

Example

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

See Also

Floating-Point Support Routines | acos | asin | atan | _matherr | sin | tan | Run-Time Routines and .NET Framework Equivalents

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.