tan
, tanf
, tanl
Berechnet den Tangens.
Syntax
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
Parameter
x
Winkel im Bogenmaß.
Rückgabewert
Die tan
-Funktionen geben den Tangens von x
zurück. Wenn x
größer oder gleich 263 oder kleiner als oder gleich -263 ist, tritt ein Verlust der Bedeutung im Ergebnis auf.
Eingabe | SEH-Ausnahme | _matherr -Ausnahme |
---|---|---|
± QNaN, IND | Keine | _DOMAIN |
± INF | INVALID |
_DOMAIN |
Hinweise
Da C++ das Überladen zulässt, können Sie Überladungen von tan
aufrufen, die float
oder long double
-Werte verwenden und zurückgeben. In einem C-Programm wird diese Funktion immer verwendet und zurückgegebendouble
, tan
es sei denn, Sie verwenden das <tgmath.h>
Makro, um diese Funktion aufzurufen.
Wenn Sie das tan
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++) |
---|---|---|
tan , tanf , tanl |
<math.h> |
<cmath> oder <math.h> |
tan -Makro |
<tgmath.h> |
Weitere Informationen zur Kompatibilität finden Sie unter Kompatibilität.
Beispiel
// 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
Siehe auch
Mathematische und Gleitkommaunterstützung
acos
, acosf
, acosl
asin
, asinf
, asinl
atan
, atanf
, atanl
, atan2
, atan2f
, atan2l
cos
, cosf
, cosl
sin
, sinf
, sinl
_CItan
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