From da78a9e329e272dedb2400b79a3bdeebff387d47 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:17 -0500 Subject: initial commit --- .../reference/global_objects/math/log2/index.html | 96 ++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 files/ko/web/javascript/reference/global_objects/math/log2/index.html (limited to 'files/ko/web/javascript/reference/global_objects/math/log2') diff --git a/files/ko/web/javascript/reference/global_objects/math/log2/index.html b/files/ko/web/javascript/reference/global_objects/math/log2/index.html new file mode 100644 index 0000000000..7cfd72531c --- /dev/null +++ b/files/ko/web/javascript/reference/global_objects/math/log2/index.html @@ -0,0 +1,96 @@ +--- +title: Math.log2() +slug: Web/JavaScript/Reference/Global_Objects/Math/log2 +translation_of: Web/JavaScript/Reference/Global_Objects/Math/log2 +--- +
{{JSRef}}
+ +

 Math.log2() 함수는 숫자를 log2(숫자)로 반환합니다.

+ +

x>0,Math.log2(x)=log2(x)=the uniqueysuch that2y=x\forall x > 0, \mathtt{\operatorname{Math.log2}(x)} = \log_2(x) = \text{the unique} \; y \; \text{such that} \; 2^y = x

+ +

문법

+ +
Math.log2(x)
+ +

매개변수

+ +
+
x
+
숫자.
+
+ +

반환 값

+ +

주어진 숫자는 log2(숫자)로 계산합니다. 만약 숫자가 음수라면 {{jsxref("NaN")}}를 반환합니다.

+ +

설명

+ +

만약 x 의 값이 0보다 작다면(음수) 값은 항상 {{jsxref("NaN")}}로 반환합니다.

+ +

log2()는 Math의 정적 메서드이므로 만든 Math 객체의 메서드가 아니라 항상 Math.log2()함수를 사용해야합니다. (Math는 생성자가 없습니다.)

+ +

이 함수는 Math.log(x) / Math.log(2)와 같습니다.

+ +

따라서 log2(e)는 {{jsxref("Math.LOG2E")}}와 같습니다. 

+ +

그리고 위 함수는 1 / {{jsxref("Math.LN2")}}과 같습니다.

+ +

예제

+ +

Math.log2()

+ +
Math.log2(3);    // 1.584962500721156
+Math.log2(2);    // 1
+Math.log2(1);    // 0
+Math.log2(0);    // -Infinity
+Math.log2(-2);   // NaN
+Math.log2(1024); // 10
+
+ +

Polyfill

+ +

This Polyfill emulates the Math.log2 function. Note that it returns imprecise values on some inputs (like 1 << 29), wrap into {{jsxref("Math.round()")}} if working with bit masks.

+ +
Math.log2 = Math.log2 || function(x) {
+  return Math.log(x) * Math.LOG2E;
+};
+
+ +

표준

+ + + + + + + + + + + + + + + + + + + +
표준상태비고
{{SpecName('ES2015', '#sec-math.log2', 'Math.log2')}}{{Spec2('ES2015')}}Initial definition.
{{SpecName('ESDraft', '#sec-math.log2', 'Math.log2')}}{{Spec2('ESDraft')}} 
+ +

브라우저 호환성

+ + + +

{{Compat("javascript.builtins.Math.log2")}}

+ +

참조

+ + -- cgit v1.2.3-54-g00ecf