blob: b91056ae7801d70ad7b9362ab4fd0629e6071d8f (
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
|
---
title: Math.SQRT1_2
slug: Web/JavaScript/Reference/Global_Objects/Math/SQRT1_2
tags:
- JavaScript
- Math
- Property
- Reference
translation_of: Web/JavaScript/Reference/Global_Objects/Math/SQRT1_2
---
<div>{{JSRef}}</div>
<p><strong><code>Math.SQRT2</code></strong> プロパティは、 1/2 の平方根、約 0.707 を表します。</p>
<p><math display="block"><semantics><mrow><mstyle mathvariant="monospace"><mi>Math.SQRT1_2</mi></mstyle><mo>=</mo><msqrt><mfrac><mn>1</mn><mn>2</mn></mfrac></msqrt><mo>=</mo><mfrac><mn>1</mn><msqrt><mn>2</mn></msqrt></mfrac><mo>≈</mo><mn>0.707</mn></mrow><annotation encoding="TeX">\mathtt{\mi{Math.SQRT1_2}} = \sqrt{\frac{1}{2}} = \frac{1}{\sqrt{2}} \approx 0.707</annotation></semantics></math></p>
<div>{{EmbedInteractiveExample("pages/js/math-sqrt1_2.html", "shorter")}}</div>
<div class="hidden">このデモのソースファイルは GitHub リポジトリに格納されています。デモプロジェクトに協力したい場合は、 <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> をクローンしてプルリクエストを送信してください。</div>
<div>{{js_property_attributes(0, 0, 0)}}</div>
<h2 id="Description" name="Description">解説</h2>
<p><code>SQRT1_2</code> は <code>Math</code> オブジェクトの静的プロパティなので、 <code>Math</code> オブジェクトを生成してプロパティとして使用するのではなく、常に <code>Math.SQRT1_2</code> として使用するようにしてください (<code>Math</code> はコンストラクターではありません)。</p>
<h2 id="Examples" name="Examples">例</h2>
<h3 id="Using_Math.SQRT1_2" name="Using_Math.SQRT1_2">Math.SQRT1_2 の使用</h3>
<p>以下の関数は 1 を 2 の平方根で割った値を返します。</p>
<pre class="brush:js notranslate">function getRoot1_2() {
return Math.SQRT1_2;
}
getRoot1_2(); // 0.7071067811865476
</pre>
<h2 id="Specifications" name="Specifications">仕様書</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">仕様書</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{SpecName('ESDraft', '#sec-math.sqrt1_2', 'Math.SQRT1_2')}}</td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>
<p>{{Compat("javascript.builtins.Math.SQRT1_2")}}</p>
<h2 id="See_also" name="See_also">関連情報</h2>
<ul>
<li>{{jsxref("Math.pow()")}}</li>
<li>{{jsxref("Math.sqrt()")}}</li>
</ul>
|