tanh
, tanhf
, tanhl
tanh
, tanhf
, tanhl
Calcula la tangente hiperbólica.Calculates the hyperbolic tangent.
SintaxisSyntax
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ámetrosParameters
x
Ángulo en radianes.Angle in radians.
Valor devueltoReturn value
Las tanh
funciones devuelven la tangente hiperbólica de x
.The tanh
functions return the hyperbolic tangent of x
. No se devuelve ningún error.There's no error return.
EntradaInput | Excepción SEHSEH exception | Matherr excepcionalMatherr exception |
---|---|---|
± QNAN ,IND ± QNAN ,IND |
ningunonone | _DOMAIN |
ComentariosRemarks
Dado que C++ permite las sobrecargas, puede llamar a las sobrecargas de tanh
que toman y devuelven float
long double
los valores o.Because C++ allows overloading, you can call overloads of tanh
that take and return float
or long double
values. En un programa de C, a menos que esté usando la <tgmath.h>
macro para llamar a esta función, tanh
siempre toma y devuelve double
.In a C program, unless you're using the <tgmath.h>
macro to call this function, tanh
always takes and returns double
.
Si usa la <tgmath.h>
tanh()
macro, el tipo del argumento determina qué versión de la función está seleccionada.If you use the <tgmath.h>
tanh()
macro, the type of the argument determines which version of the function is selected. Vea Math de tipo genérico para obtener más información.See Type-generic math for details.
De forma predeterminada, el ámbito de este estado global de esta función es la aplicación.By default, this function's global state is scoped to the application. Para cambiar esto, vea estado global en CRT.To change this, see Global state in the CRT.
RequisitosRequirements
RutinaRoutine | Encabezado necesario (C)Required header (C) | Encabezado necesario (C)Required header (C) |
---|---|---|
tanh , tanhf , tanhl tanh , tanhf , tanhl |
<math.h> |
<cmath> o <math.h> <cmath> or <math.h> |
tanh() macrotanh() macro |
<tgmath.h> |
Para obtener más información sobre compatibilidad, vea Compatibility.For more compatibility information, see Compatibility.
EjemploExample
// 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énSee also
Compatibilidad de punto flotanteFloating-Point Support
acosh, acoshf, acoshl
asinh, asinhf, asinhl
atanh, atanhf, atanhl
cosh, coshf, coshl
sinh, sinhf, sinhl