Partager via


tanh, tanhf, tanhl

Calcule la tangente hyperbolique.

Syntaxe

double tanh( double x );
float tanhf( float x );
long double tanhl( long double x );
#define tanh(x) // Requires C11 or higher
float tanh( float x );  // C++ only
long double tanh( long double x );  // C++ only

Paramètres

x
Angle en radians.

Valeur retournée

Les fonctions tanh retournent la tangente hyperbolique de x. Il n’y a pas de retour d’erreur.

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

Notes

C++ autorisant la surcharge, vous pouvez appeler des surcharges de tanh 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, tanh prend toujours et retourne double.

Si vous utilisez la tanh 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)
tanh, tanhf, tanhl <math.h> <cmath> ou <math.h>
Macro tanh <tgmath.h>

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

Exemple

// crt_tanh.c
// This program displays the tangent of pi / 4
// and the hyperbolic tangent of the result.
// Compile by using: cl crt_tanh.c

#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

Voir aussi

Prise en charge mathématique et à virgule flottante
acosh, acoshf, acoshl
asinh, asinhf, asinhl
atanh, atanhf, atanhl
cosh, coshf, coshl
sinh, sinhf, sinhl