blob: 0f9d932e6f8f646b3a48430b6c2a364a9c0749ec (
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
|
---
title: Math.SQRT1_2
slug: Web/JavaScript/Reference/Global_Objects/Math/SQRT1_2
tags:
- JavaScript
- Math
- Property
- Propriedade
- Reference
- Referencia
translation_of: Web/JavaScript/Reference/Global_Objects/Math/SQRT1_2
---
<div>{{JSRef}}</div>
<p>A propriedade <code>Math.SQRT1_2</code> representa a raiz quadrada de <math><semantics><mfrac><mn>1</mn><mn>2</mn></mfrac><annotation encoding="TeX">\frac{1}{2}</annotation></semantics></math>, que é aproximadamente 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="Descrição">Descrição</h2>
<p>Por <code>SQRT1_2</code> ser um método estático de <code>Math</code>, deve-se sempre usá-lo como <code>Math.SQRT1_2()</code>, e não como um método de um objeto <code>Math</code> que você criou.</p>
<h2 id="Exemplos">Exemplos</h2>
<h3 id="Usando_Math.SQRT1_2">Usando <code>Math.SQRT1_2</code></h3>
<p>A função a seguir retorna 1 sobre a raiz quadrada de 2:</p>
<pre class="brush:js">function getRoot1_2() {
return Math.SQRT1_2;
}
getRoot1_2(); // 0.7071067811865476
</pre>
<h2 id="Especificações">Especificações</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</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.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>
<tr>
<td>{{SpecName('ESDraft', '#sec-math.sqrt1_2', 'Math.SQRT1_2')}}</td>
<td>{{Spec2('ESDraft')}}</td>
<td> </td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility">Compatibilidade com navegadores</h2>
<p>{{Compat("javascript.builtins.Math.SQRT1_2")}}</p>
<h2 id="Veja_também">Veja também</h2>
<ul>
<li>{{jsxref("Math.pow()")}}</li>
<li>{{jsxref("Math.sqrt()")}}</li>
</ul>
|