Latest web development tutorials

C-Bibliotheksfunktionen - atan2 ()

C Standard-Bibliothek - <math.h> C Standard - Bibliothek - <math.h>

Beschreibung

C - BibliotheksfunktionenDoppel atan2 (doppelt y, double x ) Gibt die yin Radiant/ xarctangent ausgedrückt. Symbolwerte y und x den richtigen Quadranten bestimmen.

Erklärung

Es folgt eine Erklärung atan2 () Funktion.

double atan2(doubly y, double x)

Parameter

  • x - x im Namen von Gleitkommazahlen koordinieren.
  • y - y-Achse repräsentiert die Koordinaten von Fließkommawerte.

Rückgabewert

Diese Funktion gibt die y in Radiant / x arctangent ausgedrückt, in Radiant Intervall [-pi, + pi].

Beispiele

Das folgende Beispiel zeigt die atan2 () Funktion verwendet wird.

#include <stdio.h>
#include <math.h>

#define PI 3.14159265

int main ()
{
   double x, y, ret, val;

   x = -7.0;
   y = 7.0;
   val = 180.0 / PI;

   ret = atan2 (y,x) * val;
   printf("x = %lf, y = %lf 的反正切", x, y);
   printf("是 %lf 度\n", ret);
  
   return(0);
}

Lassen Sie uns zusammenzustellen und um das obige Programm ausführen, die in der folgenden führen:

x = -7.000000, y = 7.000000 的反正切是 135.000000 度

C Standard-Bibliothek - <math.h> C Standard - Bibliothek - <math.h>