tanh
, tanhf
, tanhl
Berechnet den hyperbolischen Tangens.
Syntax
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
Parameter
x
Winkel im Bogenmaß.
Rückgabewert
Die tanh
-Funktionen geben den Hyperbeltangens von x
zurück. Es wird kein Fehler zurückgegeben.
Eingabe | SEH-Ausnahme | _matherr -Ausnahme |
---|---|---|
± QNaN, IND | Keine | _DOMAIN |
Hinweise
Da C++ das Überladen zulässt, können Sie Überladungen von tanh
aufrufen, die float
oder long double
-Werte verwenden und zurückgeben. In einem C-Programm wird diese Funktion immer verwendet und zurückgegebendouble
, tanh
es sei denn, Sie verwenden das <tgmath.h>
Makro, um diese Funktion aufzurufen.
Wenn Sie das tanh
Makro <tgmath.h>
verwenden, bestimmt der Typ des Arguments, welche Version der Funktion ausgewählt ist. Ausführliche Informationen finden Sie unter "Typgenerika" .
Standardmäßig gilt der globale Zustand dieser Funktion für die Anwendung. Informationen zum Ändern dieses Verhaltens finden Sie im Global state in the CRT.
Anforderungen
Routine | Erforderlicher Header (C) | Erforderlicher Header (C) |
---|---|---|
tanh , tanhf , tanhl |
<math.h> |
<cmath> oder <math.h> |
tanh -Makro |
<tgmath.h> |
Weitere Informationen zur Kompatibilität finden Sie unter Kompatibilität.
Beispiel
// 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
Siehe auch
Mathematische und Gleitkommaunterstützung
acosh
, acoshf
, acoshl
asinh
, asinhf
, asinhl
atanh
, atanhf
, atanhl
cosh
, coshf
, coshl
sinh
, sinhf
, sinhl
Feedback
https://aka.ms/ContentUserFeedback.
Bald verfügbar: Im Laufe des Jahres 2024 werden wir GitHub-Issues stufenweise als Feedbackmechanismus für Inhalte abbauen und durch ein neues Feedbacksystem ersetzen. Weitere Informationen finden Sie unterFeedback senden und anzeigen für