x | Winkel im Bogenmaß |
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.
#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'; } }