tanh, tanhf, tanhl

Calcula la tangente hiperbólica.

Sintaxis

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

Parámetros

x
Ángulo en radianes.

Valor devuelto

Las funciones de tanh devuelven la tangente hiperbólica de x. No se devuelve ningún error.

Entrada Excepción SEH Excepción de _matherr
± QNaN, IND None _DOMAIN

Comentarios

Puesto que C++ permite las sobrecargas, es posible llamar a las sobrecargas de tanh que toman y devuelven los valores float o long double. En un programa de C, a menos que use la macro <tgmath.h> para llamar a esta función, tanh siempre toma y devuelve double.

Si usa la tanh macro de <tgmath.h>, el tipo del argumento determina qué versión de la función está seleccionada. Consulte Matemáticas de tipo genérico para obtener más información.

De manera predeterminada, el estado global de esta función está limitado a la aplicación. Para cambiar este comportamiento, consulte Estado global en CRT.

Requisitos

Routine Encabezado necesario (C) Encabezado necesario (C)
tanh, tanhf, tanhl <math.h> <cmath> o <math.h>
tanhMacro <tgmath.h>

Para obtener más información sobre compatibilidad, consulte Compatibilidad.

Ejemplo

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

Consulte también

Compatibilidad con matemáticas y punto flotante
acosh, acoshf, acoshl
asinh, asinhf, asinhl
atanh, atanhf, atanhl
cosh, coshf, coshl
sinh, sinhf, sinhl