Freigeben über


tan, tanf, tanl, tanh, tanhf, tanhl

Berechnet den Tangens (tan, tanf oder tanl) oder den Hyperbeltangens (tanh, tanhf oder tanhl).

double tan(
   double x 
);
float tan(
   float x 
);  // C++ only
long double tan(
   long double x
);  // C++ only
float tanf(
   float x 
);
long double tanl(
   long double x
);
double tanh(
   double x 
);
float tanh(
   float x 
);  // C++ only
long double tanh(
   long double x
);  // C++ only
float tanhf(
   float x 
);
long double tanhl(
   long double x
);

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 oder gleich – 263 ist, kommt es im Ergebnis zu einem Bedeutungsverlust.

Die tanh-Funktionen geben den Hyperbeltangens von x zurück. Es gibt keine Fehlerrückgabe.

Eingabe

SEH-Ausnahme

Matherr-Ausnahme

± QNAN,IND

Keine

_DOMAIN

± ∞ (tan, tanf)

INVALID

_DOMAIN

Hinweise

Da C++ das Überladen zulässt, können Sie Überladungen von tan und tanh aufrufen, die float- oder long double-Werte verwenden und zurückgeben. In einem C-Programm verwenden tan und tanh immer double und geben "Double" auch zurück.

Anforderungen

Routine

Erforderlicher Header

tan, tanf, tanl, tanh, tanhf, tanhl

<math.h>

Zusätzliche Informationen zur Kompatibilität finden Sie unter Kompatibilität.

Beispiel

// crt_tan.c
// This program displays the tangent of pi / 4
// and the hyperbolic tangent of the result.
//

#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 );
}
  

.NET Framework-Entsprechung

Siehe auch

Referenz

Gleitkommaunterstützung

Long Double

acos, acosf, acosl

asin, asinf, asinl

atan, atanf, atanl, atan2, atan2f, atan2l

cos, cosf, cosl, cosh, coshf, coshl

sin, sinf, sinl, sinh, sinhf, sinhl

_CItan