Namespaces
Variants

atan, atanf, atanl

From cppreference.net
< c ‎ | numeric ‎ | math
Common mathematical functions
Functions
Basic operations
(C99)
(C99)
(C99)
(C99) (C99) (C99) (C23)
Maximum/minimum operations
Exponential functions
Power functions
Trigonometric and hyperbolic functions
Nearest integer floating-point
(C99) (C99) (C99)
(C23) (C23) (C23) (C23)
Floating-point manipulation
Narrowing operations
(C23)
(C23)
(C23)
(C23)
(C23)
(C23)
Quantum and quantum exponent
Decimal re-encoding functions
Total order and payload functions
Classification
Error and gamma functions
(C99)
(C99)
(C99)
(C99)
Types
Macro constants
Special floating-point values
Arguments and return values
Error handling
Fast operation indicators
Definiert in Header <math.h>
float atanf ( float arg ) ;
(1) (seit C99)
double atan ( double arg ) ;
(2)
long double atanl ( long double arg ) ;
(3) (seit C99)
_Decimal32  atand32 ( _Decimal32 arg ) ;
(4) (seit C23)
_Decimal64  atand64 ( _Decimal64 arg ) ;
(5) (seit C23)
_Decimal128 atand128 ( _Decimal128 arg ) ;
(6) (seit C23)
Definiert in Header <tgmath.h>
#define atan( arg )
(7) (seit C99)
1-6) Berechnet den Hauptwert des Arkustangens von arg .
7) Typgenerisches Makro: Wenn das Argument den Typ long double hat, (3) ( atanl ) wird aufgerufen. Andernfalls, wenn das Argument einen Ganzzahltyp oder den Typ double hat, (2) ( atan ) wird aufgerufen. Andernfalls (1) ( atanf ) wird aufgerufen. Wenn das Argument komplex ist, ruft das Makro die entsprechende komplexe Funktion auf ( catanf , catan , catanl ).

Die Funktionen (4-6) werden genau dann deklariert, wenn die Implementierung __STDC_IEC_60559_DFP__ vordefiniert (d.h. die Implementierung unterstützt dezimale Gleitkommazahlen).

(seit C23)

Inhaltsverzeichnis

Parameter

arg - Gleitkommawert

Rückgabewert

If no errors occur, the arc tangent of arg ( arctan(arg) ) 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 festgelegt.

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 spezifiziert , dass im Fall eines Unterlaufs arg unverändert zurückgegeben wird, und falls dies nicht unterstützt wird, ein implementierungsdefinierter Wert zurückgegeben wird, der nicht größer als DBL_MIN , FLT_MIN , und LDBL_MIN ist.

Beispiel

#include <math.h>
#include <stdio.h>
int main(void)
{
    printf("atan(1) = %f, 4*atan(1)=%f\n", atan(1), 4 * atan(1));
    // special values
    printf("atan(Inf) = %f, 2*atan(Inf) = %f\n", atan(INFINITY), 2 * atan(INFINITY));
    printf("atan(-0.0) = %+f, atan(+0.0) = %+f\n", atan(-0.0), atan(0));
}

Ausgabe:

atan(1) = 0.785398, 4*atan(1)=3.141593
atan(Inf) = 1.570796, 2*atan(Inf) = 3.141593
atan(-0.0) = -0.000000, atan(+0.0) = +0.000000

Referenzen

  • C23-Standard (ISO/IEC 9899:2024):
  • 7.12.4.3 Die atan-Funktionen (S: TBD)
  • 7.25 Typgenerische Mathematik <tgmath.h> (S: TBD)
  • F.10.1.3 Die atan-Funktionen (S: TBD)
  • C17-Standard (ISO/IEC 9899:2018):
  • 7.12.4.3 Die atan-Funktionen (S: 174)
  • 7.25 Typgenerische Mathematik <tgmath.h> (S: 272-273)
  • F.10.1.3 Die atan-Funktionen (S: 378)
  • C11-Standard (ISO/IEC 9899:2011):
  • 7.12.4.3 Die atan-Funktionen (S: 238-239)
  • 7.25 Typgenerische Mathematik <tgmath.h> (S: 373-375)
  • F.10.1.3 Die atan-Funktionen (S: 519)
  • C99-Standard (ISO/IEC 9899:1999):
  • 7.12.4.3 Die atan-Funktionen (S. 219)
  • 7.22 Typgenerische Mathematik <tgmath.h> (S. 335-337)
  • F.9.1.3 Die atan-Funktionen (S. 456)
  • C89/C90 Standard (ISO/IEC 9899:1990):
  • 4.5.2.3 Die atan-Funktion

Siehe auch

berechnet den Arkustangens unter Verwendung von Vorzeichen zur Bestimmung der Quadranten
(Funktion)
(C99) (C99)
berechnet den Arkussinus ( arcsin(x) )
(Funktion)
(C99) (C99)
berechnet den Arkuskosinus ( arccos(x) )
(Funktion)
(C99) (C99)
berechnet den Tangens ( tan(x) )
(Funktion)
(C99) (C99) (C99)
berechnet den komplexen Arkustangens
(Funktion)