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
|
---
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("Global_Objects", "Math")}}</div>
<h2 id="Summary">Сводка</h2>
<p>Свойство <strong><code>Math.SQRT1_2</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>{{js_property_attributes(0, 0, 0)}}</div>
<h2 id="Description">Описание</h2>
<p>Поскольку свойство <code>SQRT1_2</code> является статическим свойством объекта <code>Math</code>, вы всегда должны использовать его как <code>Math.SQRT1_2</code>, а не пытаться создавать экземпляр объекта <code>Math</code> и получать свойство от него (поскольку объект <code>Math</code> не является конструктором).</p>
<h2 id="Examples">Примеры</h2>
<h3 id="Example:_Using_Math.SQRT1_2">Пример: использование свойства <code>Math.SQRT1_2</code></h3>
<p>Следующая функция возвращает единицу, делённую на квадратный корень из двух:</p>
<pre class="brush: js">function getRoot1_2() {
return Math.SQRT1_2;
}
getRoot1_2(); // 0.7071067811865476
</pre>
<h2 id="Specifications">Спецификации</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Спецификация</th>
<th scope="col">Статус</th>
<th scope="col">Комментарии</th>
</tr>
<tr>
<td>ECMAScript 1-е издание.</td>
<td>Стандарт</td>
<td>Изначальное определение. Реализована в JavaScript 1.0.</td>
</tr>
<tr>
<td>{{SpecName('ES5.1', '#sec-15.8.1.7', 'Math.SQRT1_2')}}</td>
<td>{{Spec2('ES5.1')}}</td>
<td> </td>
</tr>
<tr>
<td>{{SpecName('ES6', '#sec-math.sqrt1_2', 'Math.SQRT1_2')}}</td>
<td>{{Spec2('ES6')}}</td>
<td> </td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility">Совместимость с браузерами</h2>
<p>{{Compat}}</p>
<h2 id="See_also">Смотрите также</h2>
<ul>
<li>{{jsxref("Math.pow()")}}</li>
<li>{{jsxref("Math.sqrt()")}}</li>
</ul>
|