我要评分
获取效率
正确性
完整性
易理解

atan

Compute the arctangent of the input tangent.

Interface Definition

C interface:

float atanf(float x);

double atan(double x);

long double atandl(long double x);

Fortran interface:

RES = ATANF(X)

RES = ATAN(X)

Parameters

Parameter

Type

Description

Input/Output

x

  • For atanf, x is of single-precision floating-point type.
  • For atan, x is of double-precision floating-point type.
  • For atanl, x is of long double-precision floating-point type.

Floating-point value of a tangent value.

Input

Return Value

  • The arctangent y of tangent x is returned. y ∈ (-π/2, +π/2)
  • If the input is +0, the return value is +0.
  • If the input is -0, the return value is -0.
  • If the input is +∞, the return value is +π/2.
  • If the input is -∞, the return value is -π/2.
  • If the input is NaN, the return value is NaN.

Dependency

C: "km.h"

Examples

C interface:

    double pi = acos(-1); 
    // typical usage 
    double a = pi/3, c = -3*pi/4, b = pi/2; 
    // special handling 
    double d = +0.0, h = -0.0, e = INFINITY, f = -INFINITY, g = NAN; 
    double complex k = 0 + 0 * I;
    // print result 
    printf("atan(pi/3) = %.15f\n", atan(a)); 
    printf("atan(-3*pi/4) = %.15f\n", atan(c)); 
    printf("atan(pi/2) = %.15f\n", atan(b)); 
    printf("atan(+0.0) = %+.15f\n", atan(d)); 
    printf("atan(-0.0) = %+.15f\n", atan(h)); 
    printf("atan(INFINITY) = %+.15f\n", atan(e)); 
    printf("atan(-INFINITY) = %+.15f\n", atan(f)); 
    printf("atan(NAN) = %.15f\n", atan(g)); 
    /* 
     *  atan(pi/3) = 0.808448792630022 
     *  atan(-3*pi/4) = -1.169422824815756 
     *  atan(pi/2) = 1.003884821853887 
     *  atan(+0.0) = +0.000000000000000 
     *  atan(-0.0) = -0.000000000000000 
     *  atan(INFINITY) = +1.570796326794897 
     *  atan(-INFINITY) = -1.570796326794897 
     *  atan(NAN) = nan 
     * */

Fortran interface:

    REAL(8) :: X = 0.0 
    PRINT*,  ATAN(X) 
    ! 
    ! OUTPUT 
    !     0.000000000000000 
    !