diff options
| author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
|---|---|---|
| committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
| commit | 074785cea106179cb3305637055ab0a009ca74f2 (patch) | |
| tree | e6ae371cccd642aa2b67f39752a2cdf1fd4eb040 /files/pt-br/web/javascript/reference/global_objects/math/pow/index.html | |
| parent | da78a9e329e272dedb2400b79a3bdeebff387d47 (diff) | |
| download | translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.gz translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.bz2 translated-content-074785cea106179cb3305637055ab0a009ca74f2.zip | |
initial commit
Diffstat (limited to 'files/pt-br/web/javascript/reference/global_objects/math/pow/index.html')
| -rw-r--r-- | files/pt-br/web/javascript/reference/global_objects/math/pow/index.html | 147 |
1 files changed, 147 insertions, 0 deletions
diff --git a/files/pt-br/web/javascript/reference/global_objects/math/pow/index.html b/files/pt-br/web/javascript/reference/global_objects/math/pow/index.html new file mode 100644 index 0000000000..0a478feb5a --- /dev/null +++ b/files/pt-br/web/javascript/reference/global_objects/math/pow/index.html @@ -0,0 +1,147 @@ +--- +title: Math.pow() +slug: Web/JavaScript/Reference/Global_Objects/Math/pow +tags: + - Função + - JavaScript + - Método(2) + - Referência(2) + - expoente + - potência +translation_of: Web/JavaScript/Reference/Global_Objects/Math/pow +--- +<div>{{JSRef}}</div> + +<p>A função <strong><code>Math.pow()</code></strong> retorna a <em>base </em>elevada ao expoente <em>power</em>, ou seja, <code>base<sup>expoente</sup></code>.</p> + +<h2 id="Sintaxe">Sintaxe</h2> + +<pre class="syntaxbox"><code>Math.pow(<var>base</var>, <var>expoente</var>)</code></pre> + +<h3 id="Parâmetros">Parâmetros</h3> + +<dl> + <dt><code>base</code></dt> + <dd>O número da base.</dd> + <dt><code>expoente</code></dt> + <dd>O expoente usado para elevar a <code>base</code>.</dd> +</dl> + +<h2 id="Descrição">Descrição</h2> + +<p>Como <code>pow()</code> é um método estático de <code>Math</code>, você sempre irá usá-lo como <code>Math.pow()</code>, ao invés de usá-lo como um método de um objeto do tipo <code>Math</code> que você tenha criado (<code>Math</code> não é um construtor).</p> + +<h2 id="Exemplos">Exemplos</h2> + +<h3 id="Usando_Math.pow()">Usando <code>Math.pow()</code></h3> + +<pre class="brush: js">// simples +Math.pow(7, 2); // 49 +Math.pow(7, 3); // 343 +Math.pow(2, 10); // 1024 +// expoentes fracionários +Math.pow(4, 0.5); // 2 (raiz quadrada de 4) +Math.pow(8, 1/3); // 2 (raiz cúbica de 8) +Math.pow(2, 0.5); // 1.4142135623730951 (raiz quadrada de 2) +Math.pow(2, 1/3); // 1.2599210498948732 (raiz cúbica de 2) +// expoentes com sinais +Math.pow(7, -2); // 0.02040816326530612 == (1/7)<sup>2 </sup>== (1/49) +Math.pow(8, -1/3); // 0.5 == (1/8)<sup>1/3</sup> == 1/2 +// bases com sinal +Math.pow(-7, 2); // 49 (quadrados sempre são positivos) +Math.pow(-7, 3); // -343 (cubos podem ser negativos conforme a base) +Math.pow(-7, 0.5); // NaN (números negativos não tem uma raiz quadrada real) +// devido ao fato que raízes "par" e "ímpar" são próximas, +// e limitam a precisão de ponto flutuante, +// bases negativas com expoentes fracionários sempre retornam NaN +Math.pow(-7, 1/3); // NaN +</pre> + +<h2 id="Especificações">Especificações</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Especificação</th> + <th scope="col">Status</th> + <th scope="col">Comentário</th> + </tr> + <tr> + <td>{{SpecName('ES1')}}</td> + <td>{{Spec2('ES1')}}</td> + <td>Definição Inicial. Implementado no JavaScript 1.0.</td> + </tr> + <tr> + <td>{{SpecName('ES5.1', '#sec-15.8.2.13', 'Math.pow')}}</td> + <td>{{Spec2('ES5.1')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('ES6', '#sec-math.pow', 'Math.pow')}}</td> + <td>{{Spec2('ES6')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Compatibilidade_com_Navegadores">Compatibilidade com Navegadores</h2> + +<div>{{CompatibilityTable}}</div> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Funcionalidade</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Suporte Básico</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Funcionalidade</th> + <th>Android</th> + <th>Chrome for Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Suporte Básico</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<h2 id="Veja_também">Veja também</h2> + +<ul> + <li>{{jsxref("Math.cbrt()")}} {{experimental_inline}}</li> + <li>{{jsxref("Math.exp()")}}</li> + <li>{{jsxref("Math.log()")}}</li> + <li>{{jsxref("Math.sqrt()")}}</li> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Exponentiation" title="Arithmetic operators take numerical values (either literals or variables) as their operands and return a single numerical value. The standard arithmetic operators are addition (+), subtraction (-), multiplication (*), and division (/).">Operador Exponencial</a> {{experimental_inline}}</li> +</ul> |
