영어로 읽기

다음을 통해 공유


Math.Atan(Double) 메서드

정의

탄젠트를 적용했을 때 지정된 숫자가 나오는 각도를 반환합니다.

public static double Atan(double d);

매개 변수

d
Double

접선을 나타내는 숫자입니다.

반환

-π/2 ≤ θ ≤ π/2 범위의 각도 θ(라디안)입니다.

또는

dNaN과 같으면 NaN이고, dNegativeInfinity와 같으면 배정밀도로 반올림된 -π/2(-1.5707963267949)이고, dPositiveInfinity와 같으면 배정밀도로 반올림된 π/2(1.5707963267949)입니다.

예제

다음 예제에서는 값의 아크탄젠트를 계산하고 콘솔에 표시하는 방법을 보여 줍니다.

// This example demonstrates Math.Atan()
//                           Math.Atan2()
//                           Math.Tan()
using System;

class Sample
{
    public static void Main()
    {
    double x = 1.0;
    double y = 2.0;
    double angle;
    double radians;
    double result;

// Calculate the tangent of 30 degrees.
    angle = 30;
    radians = angle * (Math.PI/180);
    result = Math.Tan(radians);
    Console.WriteLine("The tangent of 30 degrees is {0}.", result);

// Calculate the arctangent of the previous tangent.
    radians = Math.Atan(result);
    angle = radians * (180/Math.PI);
    Console.WriteLine("The previous tangent is equivalent to {0} degrees.", angle);

// Calculate the arctangent of an angle.
    String line1 = "{0}The arctangent of the angle formed by the x-axis and ";
    String line2 = "a vector to point ({0},{1}) is {2}, ";
    String line3 = "which is equivalent to {0} degrees.";

    radians = Math.Atan2(y, x);
    angle = radians * (180/Math.PI);

    Console.WriteLine(line1, Environment.NewLine);
    Console.WriteLine(line2, x, y, radians);
    Console.WriteLine(line3, angle);
    }
}
/*
This example produces the following results:

The tangent of 30 degrees is 0.577350269189626.
The previous tangent is equivalent to 30 degrees.

The arctangent of the angle formed by the x-axis and
a vector to point (1,2) is 1.10714871779409,
which is equivalent to 63.434948822922 degrees.
*/

설명

양수 반환 값은 x축의 시계 반대 방향 각도를 나타냅니다. 음수 반환 값은 시계 방향 각도를 나타냅니다.

반환 값을 180/Math.PI 로 곱하여 라디안에서 도로 변환합니다.

이 메서드는 기본 C 런타임을 호출하며 정확한 결과 또는 유효한 입력 범위는 서로 다른 운영 체제 또는 아키텍처 간에 다를 수 있습니다.

적용 대상

제품 버전
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1
UWP 10.0