atan, atanf, atan2, atan2f

Calcola l'arcotangente di x (atan o atanf) o l'arcotangente di yox (atan2 o atan2f).

double atan( 
   double x 
);
float atan(
   float x 
);  // C++ only
long double atan(
   long double x
);  // C++ only
double atan2( 
   double y, 
   double x 
);
float atan2(
   float y,
   float x
);  // C++ only
long double atan2(
   long double y,
   long double x
);  // C++ only
float atanf( 
   float x 
);
float atan2f(
   float y,
   float x
);

Parametri

  • x, y
    I numeri.

Valore restituito

atan restituisce l'arcotangente di x nell'ordine e di π/2 in radianti π/2.atan2 restituisce l'arcotangente di y/x nell'intervallo - π in radianti di π.se x è 0, atan restituisce 0.se entrambi i parametri di atan2 è 0, restituisce 0 di funzione.Tutti i risultati sono in radianti.

atan2 utilizza i segni di entrambi i parametri determinare il quadrante del valore restituito.

Input

SEH eccezione

eccezione di Matherr

± QNAN,IND

nessuno

_DOMAIN

Note

atan la funzione calcola l'arcotangente di x.atan2 calcola l'arcotangente di yox (se x uguale a 0, atan2 restituisce se π/2 y è positivo, - se π/2 y è negativo, oppure 0 se y è 0.)

atan dispone di un'implementazione che utilizza le estensioni di flusso 2 (SSE2) di SIMD.vedere _set_SSE2_enable per informazioni e le restrizioni sull'implementazione SSE2.

C++ consente l'overload, pertanto è possibile chiamare gli overload di atan e atan2.In un programma c, atan e atan2 sempre prendere e restituire i double.

Requisiti

routine

Intestazione di associazione

atan, atan2, atanf, atan2f

<math.h>

Esempio

// crt_atan.c
// arguments: 5 0.5
#include <math.h>
#include <stdio.h>
#include <errno.h>

int main( int ac, char* av[] ) 
{
   double x, y, theta;
   if( ac != 3 ){
      fprintf( stderr, "Usage: %s <x> <y>\n", av[0] );
      return 1;
   }
   x = atof( av[1] );
   theta = atan( x );
   printf( "Arctangent of %f: %f\n", x, theta );
   y = atof( av[2] );
   theta = atan2( y, x );
   printf( "Arctangent of %f / %f: %f\n", y, x, theta ); 
   return 0;
}
  

Equivalente .NET Framework

Vedere anche

Riferimenti

Supporto per le operazioni in virgola mobile

acos, acosf

asin, asinf

coseno, cosf, manganello, coshf

_matherr

sin, sinf, sinh, sinhf

marrone chiaro, tanf, tanh, tanhf

_CIatan

_CIatan2