Namespaces
Variants

std:: atan, std:: atanf, std:: atanl

From cppreference.net
Common mathematical functions
Nearest integer floating point operations
(C++11)
(C++11)
(C++11) (C++11) (C++11)
Floating point manipulation functions
(C++11) (C++11)
(C++11)
(C++11)
Classification and comparison
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
Types
(C++11)
(C++11)
(C++11)
Macro constants
Definiert in Header <cmath>
(1)
float atan ( float num ) ;

double atan ( double num ) ;

long double atan ( long double num ) ;
(bis C++23)
/*floating-point-type*/
atan ( /*floating-point-type*/ num ) ;
(seit C++23)
(constexpr seit C++26)
float atanf ( float num ) ;
(2) (seit C++11)
(constexpr seit C++26)
long double atanl ( long double num ) ;
(3) (seit C++11)
(constexpr seit C++26)
SIMD-Überladung (seit C++26)
Definiert in Header <simd>
template < /*math-floating-point*/ V >

constexpr /*deduced-simd-t*/ < V >

atan ( const V & v_num ) ;
(S) (seit C++26)
Definiert in Header <cmath>
template < class Integer >
double atan ( Integer num ) ;
(A) (constexpr seit C++26)
1-3) Berechnet den Hauptwert des Arkustangens von num . Die Bibliothek bietet Überladungen von std::atan für alle cv-unqualifizierten Gleitkommatypen als Typ des Parameters an. (since C++23)
S) Die SIMD-Überladung führt eine elementweise std::atan -Operation auf v_num durch.
(Siehe math-floating-point und deduced-simd-t für deren Definitionen.)
(seit C++26)
A) Zusätzliche Überladungen werden für alle Ganzzahltypen bereitgestellt, die als double behandelt werden.
(since C++11)

Inhaltsverzeichnis

Parameter

num - Gleitkomma- oder Ganzzahlwert

Rückgabewert

If no errors occur, the arc tangent of num ( arctan(num) ) in the range [-
π
2
, +
π
2
]
radians, is returned.

Wenn ein Bereichsfehler aufgrund von Unterlauf auftritt, wird das korrekte Ergebnis (nach Rundung) zurückgegeben.

Fehlerbehandlung

Fehler werden gemeldet, wie in math_errhandling spezifiziert.

Wenn die Implementierung IEEE-Gleitkommaarithmetik (IEC 60559) unterstützt,

  • Wenn das Argument ±0 ist, wird es unverändert zurückgegeben.
  • Wenn das Argument +∞ ist, wird +π/2 zurückgegeben.
  • Wenn das Argument -∞ ist, wird -π/2 zurückgegeben.
  • Wenn das Argument NaN ist, wird NaN zurückgegeben.

Hinweise

POSIX legt fest , dass im Fall eines Unterlaufs num unverändert zurückgegeben wird, und falls dies nicht unterstützt wird, ein implementierungsdefinierter Wert zurückgegeben wird, der nicht größer ist als DBL_MIN , FLT_MIN , und LDBL_MIN .

Die zusätzlichen Überladungen müssen nicht exakt wie (A) bereitgestellt werden. Sie müssen lediglich sicherstellen, dass für ihr Argument num vom Ganzzahltyp std :: atan ( num ) die gleiche Wirkung hat wie std :: atan ( static_cast < double > ( num ) ) .

Beispiel

#include <cmath>
#include <iostream>
int main()
{
    std::cout << "atan(1) = " << std::atan(1) << '\n'
              << "4*atan(1) = " << 4 * std::atan(1) << '\n';
    // special values
    std::cout << "atan(Inf) = " << std::atan(INFINITY) << '\n'
              << "2*atan(Inf) = " << 2 * std::atan(INFINITY) << '\n'
              << "atan(-0.0) = " << std::atan(-0.0) << '\n'
              << "atan(+0.0) = " << std::atan(0) << '\n';
}

Ausgabe:

atan(1) = 0.785398
4*atan(1) = 3.14159
atan(Inf) = 1.5708
2*atan(Inf) = 3.14159
atan(-0.0) = -0
atan(+0.0) = 0

Siehe auch

(C++11) (C++11)
berechnet den Arkussinus ( arcsin(x) )
(Funktion)
(C++11) (C++11)
berechnet den Arkuskosinus ( arccos(x) )
(Funktion)
(C++11) (C++11)
Arkustangens unter Verwendung von Vorzeichen zur Quadrantenbestimmung
(Funktion)
(C++11) (C++11)
berechnet den Tangens ( tan(x) )
(Funktion)
berechnet den Arkustangens einer komplexen Zahl ( arctan(z) )
(Funktions-Template)
wendet die Funktion std::atan auf jedes Element des valarray an
(Funktions-Template)