Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

atan2, atan2f, atan2l - Arcustangens von x/y

&pagelevel(4)&pagelevel

Definition

#include <math.h>

double atan2(double x, double y);
float atan2f(float x, float y); (C11)
long double atan2l(long double x, long double y); (C11)

Diese Funktionen berechnen den Arcustangens von x/y. Die Vorzeichen der beiden Argumente bestimmen den Ergebnisquadranten.

Returnwert

 arcustangens(x/y



eine Gleitkommazahl entsprechend des Funktionstyps vom aus dem Intervall [-pi/2, +pi/2].
Ist der Divisor y gleich 0, liefert atan2 -pi/2 bzw. +pi/2, abhängig vom Vorzeichen des Dividenden.


0

falls der Dividend x gleich 0 ist.



pi/2

falls beide Argumente gleich 0 sind. errno wird auf EDOM (domain error) gesetzt.


Beispiel

Folgendes Programm liest die Argumente x und y ein und gibt den berechneten Arcustangens von x/y aus.

#include <math.h>
#include <stdio.h>
int main(void)
{
  double x, y;
  printf("Beispiel fuer ATAN2(x/y)\n");
  printf("bitte x und y eingeben:\n");
  if (scanf("%lf %lf", &x, &y) == 2)
       printf("ATAN2 (%g / %g) = %g\n", x, y, atan2(x, y));
  return 0;
}

Siehe auch

atan, tan, sin, asin, cos, acos