Condividi tramite


atan, atanf, atanl, atan2, atan2f, atan2l

Calcola l'arcotangente di x (atan, atanf e atanl) o l'arcotangente di y/x (atan2, atan2f e atan2l).

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 
);
long double atanl(
   long double x
);
float atan2f(
   float y,
   float x
);
long double atan2l(
   long double y,
   long double x
);

Parametri

  • x, y
    Qualsiasi numero.

Valore restituito

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

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

Input

Eccezione SEH

Eccezione Matherr

± QNAN,IND

nessuno

_DOMAIN

Note

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

atan dispone di un'implementazione che utilizza Streaming SIMD Extensions 2 (SSE2). Per informazioni e le restrizioni sull'implementazione SSE2, vedere _set_SSE2_enable.

Poiché il C++ consente l'overload, è possibile chiamare gli overload di atan e atan2. In un programma C, atan e atan2 accettano e restituiscono sempre valori double.

Requisiti

Routine

Intestazione obbligatoria

atan, atan2, atanf, atan2f, atanl, atan2l

<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 a virgola mobile

acos, acosf, acosl

asin, asinf, asinl

cos, cosf, cosl, cosh, coshf, coshl

_matherr

sin, sinf, sinl, sinh, sinhf, sinhl

tan, tanf, tanl, tanh, tanhf, tanhl

_CIatan

_CIatan2