aboutsummaryrefslogtreecommitdiff
path: root/files/ca/web/javascript/reference/global_objects/math/pow/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/ca/web/javascript/reference/global_objects/math/pow/index.html')
-rw-r--r--files/ca/web/javascript/reference/global_objects/math/pow/index.html140
1 files changed, 140 insertions, 0 deletions
diff --git a/files/ca/web/javascript/reference/global_objects/math/pow/index.html b/files/ca/web/javascript/reference/global_objects/math/pow/index.html
new file mode 100644
index 0000000000..efe89000e9
--- /dev/null
+++ b/files/ca/web/javascript/reference/global_objects/math/pow/index.html
@@ -0,0 +1,140 @@
+---
+title: Math.pow()
+slug: Web/JavaScript/Referencia/Objectes_globals/Math/pow
+translation_of: Web/JavaScript/Reference/Global_Objects/Math/pow
+---
+<div>{{JSRef}}</div>
+
+<p>La funció <strong><code>Math.pow()</code></strong> retorna la <code>base</code> elevada a <code>exponent</code>, és a dir, <code>base<sup>exponent</sup></code>.</p>
+
+<h2 id="Sintaxi">Sintaxi</h2>
+
+<pre class="syntaxbox"><code>Math.pow(<var>base</var>, <var>exponent</var>)</code></pre>
+
+<h3 id="Paràmetres">Paràmetres</h3>
+
+<dl>
+ <dt><code>base</code></dt>
+ <dd>El nombre base.</dd>
+ <dt><code>exponent</code></dt>
+ <dd>L'exponent que s'usarà per a elevar la base.</dd>
+</dl>
+
+<h2 id="Descripció">Descripció</h2>
+
+<p>Com que <code>pow()</code> és un mètode estàtic de <code>Math</code>, sempre s'utilitza com <code>Math.pow()</code> en comptes de com un mètode d'un objecte <code>Math </code>creat (<code>Math </code>no és un constructor).</p>
+
+<h2 id="Exemples">Exemples</h2>
+
+<h3 id="Utilitzar_Math.pow()">Utilitzar <code>Math.pow()</code></h3>
+
+<pre class="brush: js">// simple
+Math.pow(7, 2); // 49
+Math.pow(7, 3); // 343
+Math.pow(2, 10); // 1024
+// exponents fractionals
+Math.pow(4, 0.5); // 2 (rel quadrada de 4)
+Math.pow(8, 1/3); // 2 (rel cúbica de 8)
+Math.pow(2, 0.5); // 1.412135623730951 (rel quadrada de 2)
+Math.pow(2, 1/3); // 1.2599210498948732 (rel cúbica de 2)
+// exponents amb signe
+Math.pow(7, -2); // 0.02040816326530612 (1/49)
+Math.pow(8, -1/3); // 0.5
+// bases amb signe
+Math.pow(-7, 2); // 49 (qualsevol nombre elevat al quadrat és positiu)
+Math.pow(-7, 3); // -343 (nombres elevats al cub poden ser negatius)
+Math.pow(-7, 0.5); // NaN (els nombres negatius no tenen una rel quadrada real)
+// degut a rels "parells" i "senars" estan aprox l'una de l'altra
+// i a límits en la precisió dels nombres de punt flotant,
+// bases negatives amb exponents fraccionals sempre retornen NaN
+Math.pow(-7, 1/3); // NaN
+</pre>
+
+<h2 id="Especificacions">Especificacions</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Especificació</th>
+ <th scope="col">Estat</th>
+ <th scope="col">Comentaris</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Definició inicial. Implementat a 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="Compatibilitat_amb_navegadors">Compatibilitat amb navegadors</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Característica</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Suport bàsic</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>Característica</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>Suport bàsic</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="Vegeu_també">Vegeu també</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>