Skip to content

Latest commit

 

History

History
97 lines (85 loc) · 3.52 KB

cos-cosf-cosl-cosh-coshf-coshl.md

File metadata and controls

97 lines (85 loc) · 3.52 KB
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
cpp-standard-libraries
article
coshl
cosh
cos
cosl
cosf
coshf
msvcrt.dll
msvcr80.dll
msvcr90.dll
msvcr100.dll
msvcr100_clr0400.dll
msvcr110.dll
msvcr110_clr0400.dll
msvcr120.dll
msvcr120_clr0400.dll
ucrtbase.dll
api-ms-win-crt-math-l1-1-0.dll
DLLExport
coshl
cos
cosf
cosh
cosl
coshf
C++
cosines
cosl function
calculating cosine
cosf function
cos function
cosh function
coshf function
trigonometric functions
cosines, calculating
coshl function
hyperbolic functions
ae90435e-6b68-4a47-a81f-be87d5c08f16
17
corob-msft
corob
ghogen

cos, cosf, cosl, cosh, coshf, coshl

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

Syntax

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

Parameters

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, 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

Remarks

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.

Requirements

Routine Required header
cos, cosh, cosf, coshf, cosl, coshl <math.h>

For additional compatibility information, see Compatibility.

Example

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

See Also

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