atan, atanf, atan2, atan2f

calcula el arco tangente de x (atan o atanf) o el arco tangente de y/x (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
);

Parámetros

  • x, y
    Los números.

Valor devuelto

atan devuelve el arco tangente de x en el intervalo (de π/2 los radianes π/2.atan2 devuelve el arco tangente de y/x en el intervalo comprendido π los radianes de π.si x es 0, atan devuelve 0.si ambos parámetros de atan2 son 0, la función devuelve 0.todos los resultados están en radianes.

atan2 utiliza signos de ambos parámetros de determinar el cuadrante del valor devuelto.

Entrada

ELLA excepción

excepción de Matherr

± QNAN,IND

nada

_DOMAIN

Comentarios

la función de atan calcula el arco tangente de x.atan2 calcula el arco tangente de y/x (si x equivale a 0, atan2 devuelve π/2 si y es positivo, - π/2 si y es negativo, o 0 si y es 0.)

atan tiene una implementación que utilice las extensiones 2 (SSE2) de Streaming SIMD.Vea _set_SSE2_enable para la información y las restricciones de utilizar la implementación SSE2.

C++ permite la sobrecarga, por lo que puede llamar a sobrecargas de atan y de atan2.En un programa de c., atan y atan2 toman y siempre devuelven valores double.

Requisitos

rutina

Encabezado necesario

atan, atan2, atanf, atan2f

<math.h>

Ejemplo

// 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 en .NET Framework

Vea también

Referencia

Compatibilidad de punto flotante

acos, acosf

asin, asinf

cos, cosf, garrote, coshf

_matherr

sin, sinf, sinh, sinhf

tan, tanf, tanh, tanhf

_CIatan

_CIatan2