title | ms.custom | ms.date | ms.reviewer | ms.suite | ms.technology | ms.tgt_pltfrm | ms.topic | apiname | apilocation | apitype | f1_keywords | dev_langs | helpviewer_keywords | ms.assetid | caps.latest.revision | author | ms.author | manager | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cos, cosf, cosl, cosh, coshf, coshl | Microsoft Docs |
11/04/2016 |
|
article |
|
|
DLLExport |
|
|
|
ae90435e-6b68-4a47-a81f-be87d5c08f16 |
17 |
corob-msft |
corob |
ghogen |
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.
See the example in sin, sinf, sinl, sinh, sinhf, sinhl.
Floating-Point Support
acos, acosf, acosl
asin, asinf, asinl
atan, atanf, atanl, atan2, atan2f, atan2l
_matherr
sin, sinf, sinl, sinh, sinhf, sinhl
tan, tanf, tanl, tanh, tanhf, tanhl
_CIcos