A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Math/atan below:

Math.atan() - JavaScript | MDN

Math.atan()

Baseline Widely available

Math.atan() 정적 메서드는 숫자의 역탄젠트(라디안 단위)를 반환합니다.

𝙼𝚊𝚝𝚑.𝚊𝚝𝚊𝚗 ( 𝚡 ) = arctan ( x ) = the unique  y ∊ [ − π 2 , π 2 ]  such that  tan ( y ) = x \mathtt{\operatorname{Math.atan}(x)} = \arctan(x) = \text{the unique } y \in \left[-\frac{\pi}{2}, \frac{\pi}{2}\right] \text{ such that } \tan(y) = x 시도해 보기
// Calculates angle of a right-angle triangle in radians
function calcAngle(opposite, adjacent) {
  return Math.atan(opposite / adjacent);
}

console.log(calcAngle(8, 10));
// Expected output: 0.6747409422235527

console.log(calcAngle(5, 3));
// Expected output: 1.0303768265243125
구문 매개변수 반환 값

x의 역 탄젠트 ( - π 2 -\frac{\pi}{2} 이상 π 2 \frac{\pi}{2} 이하의 라디안 단위의 각도). 만약 x가 Infinity라면 π 2 \frac{\pi}{2} 를 반환합니다. 만약 x가 -Infinity라면 - π 2 -\frac{\pi}{2} 를 반환합니다.

설명

atan()은 Math의 정적 메서드이므로, 생성한 Math 객체의 메서드가 아니라 항상 Math.atan()으로 사용합니다(Math는 생성자가 아닙니다).

예제 Math.atan() 사용하기
Math.atan(-Infinity); // -1.5707963267948966 (-π/2)
Math.atan(-0); // -0
Math.atan(0); // 0
Math.atan(1); // 0.7853981633974483  (π/4)
Math.atan(Infinity); // 1.5707963267948966  (π/2)

// 데카르트 좌표계에서 (0,0) -- (x,y) 선이 x축과 이루는 각도입니다.
const theta = (x, y) => Math.atan(y / x);

theta 함수를 피하고 대신 범위가 더 넓고(-π와 π 사이) x가 0일 경우 NaN을 출력하지 않는 Math.atan2()를 사용하는 것이 좋습니다.

명세서 브라우저 호환성 같이 보기

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4