Partager via


tan, tanf, tanl

Calcule la tangente.

Syntaxe

double tan( double x );
float tanf( float x );
long double tanl( long double x );
#define tan(x) // Requires C11 or higher
float tan( float x );  // C++ only
long double tan( long double x );  // C++ only

Paramètres

x
Angle en radians.

Valeur retournée

Les fonctions tan retournent la tangente de x. Si x elle est supérieure ou égale à 263, ou inférieure ou égale à -263, une perte de signification dans le résultat se produit.

Entrée Exception SEH Exception _matherr
± QNaN, IND aucune _DOMAIN
± INF INVALID _DOMAIN

Notes

C++ autorisant la surcharge, vous pouvez appeler des surcharges de tan qui acceptent et retournent des valeurs float ou long double. Dans un programme C, sauf si vous utilisez la <tgmath.h> macro pour appeler cette fonction, tan prend toujours et retourne double.

Si vous utilisez la tan macro à partir de <tgmath.h>laquelle , le type de l’argument détermine la version de la fonction sélectionnée. Pour plus d’informations, consultez les mathématiques génériques de type.

Par défaut, l’état global de cette fonction est limité à l’application. Pour modifier ce comportement, consultez État global dans le CRT.

Spécifications

Routine En-tête requis (C) En-tête requis (C++)
tan, tanf, tanl <math.h> <cmath> ou <math.h>
Macro tan <tgmath.h>

Pour plus d’informations sur la compatibilité, consultez Compatibility.

Exemple

// crt_tan.c
// This program displays the tangent of pi / 4
// Compile by using: cl crt_tan.c

#include <math.h>
#include <stdio.h>

int main( void )
{
   double pi = 3.1415926535;
   double x;

   x = tan( pi / 4 );
   printf( "tan( %f ) = %f\n", pi/4, x );
}
tan( 0.785398 ) = 1.000000

Voir aussi

Prise en charge mathématique et à virgule flottante
acos, acosf, acosl
asin, asinf, asinl
atan, atanf, atanl, atan2, atan2f, atan2l
cos, cosf, cosl
sin, sinf, sinl
_CItan