Skip to content

Latest commit

 

History

History
120 lines (103 loc) · 3.64 KB

tan-tanf-tanl-tanh-tanhf-tanhl.md

File metadata and controls

120 lines (103 loc) · 3.64 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
tan, tanf, tanl, tanh, tanhf, tanhl | Microsoft Docs
11/04/2016
cpp-standard-libraries
article
tanhf
tanh
tan
tanhl
tanf
tanl
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
tanh
tan
_tanl
tanl
_tanhl
tanf
tanhf
tanhl
C++
tanl function
tanhl function
_tanl function
_tanhl function
tan function
calculating tangents
tangent
tanh function
tanhf function
tanf function
trigonometric functions
hyperbolic functions
36cc0ce8-9c80-4653-b354-ddb3b378b6bd
16
corob-msft
corob
ghogen

tan, tanf, tanl, tanh, tanhf, tanhl

Calculates the tangent (tan, tanf, or tanl), or hyperbolic tangent (tanh, tanhf, or tanhl).

Syntax

double tan(  
   double x   
);  
float tan(  
   float x   
);  // C++ only  
long double tan(  
   long double x  
);  // C++ only  
float tanf(  
   float x   
);  
long double tanl(  
   long double x  
);  
double tanh(  
   double x   
);  
float tanh(  
   float x   
);  // C++ only  
long double tanh(  
   long double x  
);  // C++ only  
float tanhf(  
   float x   
);  
long double tanhl(  
   long double x  
);  

Parameters

x
Angle in radians.

Return Value

The tan functions return the tangent 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 occurs.

The tanh functions return the hyperbolic tangent of x. There is no error return.

Input SEH Exception Matherr Exception
± QNAN,IND none _DOMAIN
± ∞ (tan, tanf) INVALID _DOMAIN

Remarks

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

Requirements

Routine Required header
tan, tanf, tanl, tanh, tanhf, tanhl <math.h>

For additional compatibility information, see Compatibility.

Example

// crt_tan.c  
// This program displays the tangent of pi / 4  
// and the hyperbolic tangent of the result.  
//  
  
#include <math.h>  
#include <stdio.h>  
  
int main( void )  
{  
   double pi = 3.1415926535;  
   double x, y;  
  
   x = tan( pi / 4 );  
   y = tanh( x );  
   printf( "tan( %f ) = %f\n", pi/4, x );  
   printf( "tanh( %f ) = %f\n", x, y );  
}  
tan( 0.785398 ) = 1.000000  
tanh( 1.000000 ) = 0.761594  

See Also

Floating-Point Support
acos, acosf, acosl
asin, asinf, asinl
atan, atanf, atanl, atan2, atan2f, atan2l
cos, cosf, cosl, cosh, coshf, coshl
sin, sinf, sinl, sinh, sinhf, sinhl
_CItan