aboutsummaryrefslogtreecommitdiff
path: root/files/ko/web/javascript/reference/global_objects/math/pi/index.html
blob: 8223a68df62294d87ec101c88e925fba4841d59d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
---
title: Math.PI
slug: Web/JavaScript/Reference/Global_Objects/Math/PI
tags:
  - JavaScript
  - Math
  - Property
  - Reference
translation_of: Web/JavaScript/Reference/Global_Objects/Math/PI
---
<div>{{JSRef}}</div>

<p><strong><code>Math.PI</code></strong> 속성은 원의 둘레와 지름의 비율, 약 3.14159의 값을 가집니다.</p>

<p><math display="block"><semantics><mrow><mstyle mathvariant="monospace"><mi>Math.PI</mi></mstyle><mo>=</mo><mi>π</mi><mo></mo><mn>3.14159</mn></mrow><annotation encoding="TeX">\mathtt{\mi{Math.PI}} = \pi \approx 3.14159</annotation></semantics></math></p>

<div>{{EmbedInteractiveExample("pages/js/math-pi.html")}}</div>



<div>{{js_property_attributes(0, 0, 0)}}</div>

<h2 id="설명">설명</h2>

<p><code>PI</code><code>Math</code>의 정적 속성이므로, 사용자가 생성한 <code>Math</code> 객체의 속성으로 접근할 수 없고 항상 <code>Math.PI</code>를 사용해야 합니다. (<code>Math</code>는 생성자가 아닙니다)</p>

<h2 id="예제">예제</h2>

<h3 id="Math.PI_사용하기"><code>Math.PI</code> 사용하기</h3>

<p>다음 함수는 <code>Math.PI</code>를 사용해 주어진 원의 반지름에서 둘레를 계산합니다.</p>

<pre class="brush: js">function calculateCircumference(radius) {
  return Math.PI * (radius + radius);
}

calculateCircumference(1);  // 6.283185307179586
</pre>

<h2 id="명세">명세</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">사양</th>
   <th scope="col">등급</th>
   <th scope="col">주석</th>
  </tr>
  <tr>
   <td>{{SpecName('ES1')}}</td>
   <td>{{Spec2('ES1')}}</td>
   <td>Initial definition. Implemented in JavaScript 1.0.</td>
  </tr>
  <tr>
   <td>{{SpecName('ES5.1', '#sec-15.8.1.6', 'Math.PI')}}</td>
   <td>{{Spec2('ES5.1')}}</td>
   <td> </td>
  </tr>
  <tr>
   <td>{{SpecName('ES6', '#sec-math.pi', 'Math.PI')}}</td>
   <td>{{Spec2('ES6')}}</td>
   <td> </td>
  </tr>
  <tr>
   <td>{{SpecName('ESDraft', '#sec-math.pi', 'Math.PI')}}</td>
   <td>{{Spec2('ESDraft')}}</td>
   <td> </td>
  </tr>
 </tbody>
</table>

<h2 id="브라우저_호환성">브라우저 호환성</h2>



<p>{{Compat("javascript.builtins.Math.PI")}}</p>

<h2 id="같이_보기">같이 보기</h2>

<ul>
 <li>{{jsxref("Math")}}</li>
</ul>