diff options
| author | Florian Merz <me@fiji-flo.de> | 2021-02-11 14:45:12 +0100 |
|---|---|---|
| committer | Florian Merz <me@fiji-flo.de> | 2021-02-11 14:45:12 +0100 |
| commit | cb9e359a51c3249d8f5157db69d43fd413ddeda6 (patch) | |
| tree | ae3040d626c3b5717da5bda2af9f0a9ff9bd389f /files/ca/web/javascript/reference/global_objects/number/positive_infinity | |
| parent | 8260a606c143e6b55a467edf017a56bdcd6cba7e (diff) | |
| download | translated-content-cb9e359a51c3249d8f5157db69d43fd413ddeda6.tar.gz translated-content-cb9e359a51c3249d8f5157db69d43fd413ddeda6.tar.bz2 translated-content-cb9e359a51c3249d8f5157db69d43fd413ddeda6.zip | |
unslug ca: move
Diffstat (limited to 'files/ca/web/javascript/reference/global_objects/number/positive_infinity')
| -rw-r--r-- | files/ca/web/javascript/reference/global_objects/number/positive_infinity/index.html | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/files/ca/web/javascript/reference/global_objects/number/positive_infinity/index.html b/files/ca/web/javascript/reference/global_objects/number/positive_infinity/index.html new file mode 100644 index 0000000000..234a779fd1 --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/number/positive_infinity/index.html @@ -0,0 +1,137 @@ +--- +title: Number.POSITIVE_INFINITY +slug: Web/JavaScript/Referencia/Objectes_globals/Number/POSITIVE_INFINITY +translation_of: Web/JavaScript/Reference/Global_Objects/Number/POSITIVE_INFINITY +--- +<div>{{JSRef}}</div> + +<p>La propietat <strong><code>Number.POSITIVE_INFINITY</code></strong> representa el valor infinit negatiu.</p> + +<p>No fa falta crear un objecte {{jsxref("Global_Objects/Number", "Number")}} per accedir a aquesta propietat estàtica (feu servir <code>Number.POSITIVE_INFINITY</code>).</p> + +<div>{{js_property_attributes(0, 0, 0)}}</div> + +<h2 id="Descripció">Descripció</h2> + +<p>El valor de <code>Number.POSITIVE_INFINITY</code> és el mateix que el valor negatiu de la propietat de l'objecte global {{jsxref("Infinity")}}.</p> + +<p> </p> + +<p>Aquest valor es comporta de forma una mica diferent a l'infinit matemàtic<u>:</u></p> + +<p>Qualsevol valor positiu, incloent <code>POSITIVE_INFINITY</code>, multiplicat per <code>POSITIVE_INFINITY</code> és <code>POSITIVE_INFINITY</code>.</p> + +<ul> + <li>Qualsevol calor negatiu, incloent <code>NEGATIVE_INFINITY</code>, multiplicat per <code>POSITIVE_INFINITY</code> és {{jsxref("Number.<code>NEGATIVE</code>_INFINITY", "POSITIVE_INFINITY")}}.</li> + <li>Zero multiplicat per<code> POSITIVE_INFINITY</code> és {{jsxref("NaN")}}.</li> + <li>{{jsxref("Global_Objects/NaN", "NaN")}} multiplicat per<code>POSITIVE_INFINITY</code> és {{jsxref("NaN")}}.</li> + <li><code>POSITIVE_INFINITY</code>, dividit per quaulsevol valor negatiu execepte {{jsxref("Number.NEGATIVE_INFINITY", "NEGATIVE_INFINITY")}}, és {{jsxref("Number.NEGATIVE_INFINITY", "NEGATIVE_INFINITY")}}.</li> + <li><code>POSITIVE_INFINITY</code>, dividit per un valor positiu a excepció de<code> POSITIVE_INFINITY</code>, és <code>POSITIVE_INFINITY</code>.</li> + <li><code>POSITIVE_INFINITY</code>, dividit per {{jsxref("Number.NEGATIVE_INFINITY", "NEGATIVE_INFINITY")}} o bé per <code>POSITIVE_INFINITY</code>, és {{jsxref("NaN")}}.</li> + <li>Quasevol nombre dividit per<code> POSITIVE_INFINITY</code> és Zero.</li> +</ul> + +<p>Es pot fer serivir la propietat <code>Number.POSITIVE_INFINITY</code> per indicar una condició d'error que retorna un nombre finit en cas d'èxit. Fixeu-vos, però, que {{jsxref("isFinite")}} seria més apropiat en aquest cas.</p> + +<h2 id="Exemples">Exemples</h2> + +<h3 id="Utilitzar_POSITIVE_INFINITY">Utilitzar <code>POSITIVE_INFINITY</code></h3> + +<p>In the following example, the variable <code>bigNumber</code> is assigned a value that is larger than the maximum value. When the {{jsxref("Statements/if...else", "if")}} statement executes, <code>bigNumber</code> has the value <code>Infinity</code>, so <code>bigNumber</code> is set to a more manageable value before continuing.</p> + +<p>A l'exemple següent, a la variable <code>nombrePetit</code> se li assigna un valor que és més gran que el valor màxim. Quan la declaració {{jsxref("Statements/if...else", "if")}} s'executa, <code>nombrePetit</code> té el valor <code>Infinity</code>, així <code>nombrePetit</code> s'estableix com a un valor més manegable abans de prosseguir.</p> + +<pre class="brush: js">var nombrePetit = Number.MAX_VALUE * 2; + +if (nombrePetit == Number.POSITIVE_INFINITY) { + nombrePetit= returnFinite(); +} +</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.1.</td> + </tr> + <tr> + <td>{{SpecName('ES5.1', '#sec-15.7.3.6', 'Number.POSITIVE_INFINITY')}}</td> + <td>{{Spec2('ES5.1')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('ES6', '#sec-number.positive_infinity', 'Number.POSITIVE_INFINITY')}}</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("Number.NEGATIVE_INFINITY")}}</li> + <li>{{jsxref("Number.isFinite()")}}</li> + <li>{{jsxref("Infinity")}}</li> + <li>{{jsxref("Global_Objects/isFinite", "isFinite()")}}</li> +</ul> |
