Export (0) Print
Expand All
and
div
eof
not
or
xor
Expand Minimize

cos, cosf, cosl, cosh, coshf, coshl

Calculates the cosine (cos, cosf, or cosl), or hyperbolic cosine (cosh, coshf, or coshl).

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

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, cosf, or cosl occurs.

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

Input

SEH Exception

Matherr Exception

± QNAN,IND

none

_DOMAIN

± ∞ (cosf, cos, cosl)

INVALID

_DOMAIN

x ≥ 7.104760e+002 (cosh, coshf, coshl)

INEXACT +OVERFLOW

OVERFLOW

Because C++ allows overloading, you can call overloads of cos and cosh that take and return float or long double values. In a C program, cos and cosh always take and return a double.

Routine

Required header

cos , cosh, cosf, coshf, cosl, coshl

<math.h>

For additional compatibility information, see Compatibility.

Show:
© 2014 Microsoft