Inhaltsverzeichnis

tan()

#include <cmath>

double tan (double x) 

Liefert den Tangens von x.

Parameter

x Winkel im Bogenmaß

Ergebnis

Rückgabewert: sin(x)/cos(x). Liegt das Argument in der Nähe der Polstellen bei ungeraden Vielfachen von $\pi/2$, wird errno auf EDOM gesetzt und NAN geliefert.

Siehe auch

atan(), atan2(), cos(), sin(), tanh().

Beispiel

tan.cpp
#include <cmath>
#include <iostream>
#include <iomanip>
 
int main()
{
  const auto pi = std::acos(-1.0);
  std::cout << "#      x tan(x)\n";	
 
  for (auto x : {0.0, pi/6, pi/4, pi/3, pi/2})
  {
    std::cout << std::setw(8) << x << " " << std::tan(x) << '\n';
  }
}