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/negative_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/negative_infinity')
| -rw-r--r-- | files/ca/web/javascript/reference/global_objects/number/negative_infinity/index.html | 134 |
1 files changed, 134 insertions, 0 deletions
diff --git a/files/ca/web/javascript/reference/global_objects/number/negative_infinity/index.html b/files/ca/web/javascript/reference/global_objects/number/negative_infinity/index.html new file mode 100644 index 0000000000..3fb4c1d150 --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/number/negative_infinity/index.html @@ -0,0 +1,134 @@ +--- +title: Number.NEGATIVE_INFINITY +slug: Web/JavaScript/Referencia/Objectes_globals/Number/NEGATIVE_INFINITY +translation_of: Web/JavaScript/Reference/Global_Objects/Number/NEGATIVE_INFINITY +--- +<div>{{JSRef("Global_Objects", "Number")}}</div> + +<h2 id="Summary" name="Summary">Resum</h2> + +<p>La propietat <strong><code>Number.NEGATIVE_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.NEGATIVE_INFINITY</code>).</p> + +<div>{{js_property_attributes(0, 0, 0)}}</div> + +<h2 id="Description" name="Description">Descripció</h2> + +<p>El valor de <code>Number.NEGATIVE_INFINITY</code> és el mateix que el valor negatiu de la propietat de l'objecte global {{jsxref("Global_Objects/Infinity", "Infinity")}}.</p> + +<p>Aquest valor es comporta de forma una mica diferent a l<u>'infinit matemàtic:</u></p> + +<ul> + <li>Qualsevol valor positiu, incloent {{jsxref("Number.POSITIVE_INFINITY", "POSITIVE_INFINITY")}}, multiplicat per <code>NEGATIVE_INFINITY</code> és <code>NEGATIVE_INFINITY</code>.</li> + <li>Qualsevol calor negatiu, incloent <code>NEGATIVE_INFINITY</code>, multiplicat per <code>NEGATIVE_INFINITY</code> és {{jsxref("Number.POSITIVE_INFINITY", "POSITIVE_INFINITY")}}.</li> + <li>Zero multiplicat per <code>NEGATIVE_INFINITY</code> és {{jsxref("Global_Objects/NaN", "NaN")}}.</li> + <li>{{jsxref("Global_Objects/NaN", "NaN")}} multiplicat per <code>NEGATIVE_INFINITY</code> és {{jsxref("Global_Objects/NaN", "NaN")}}.</li> + <li><code>NEGATIVE_INFINITY</code>, dividit per qualsevol valor negatiu excepte <code>NEGATIVE_INFINITY</code>, és {{jsxref("Number.POSITIVE_INFINITY", "POSITIVE_INFINITY")}}.</li> + <li><code>NEGATIVE_INFINITY</code>, dividit per qualsevol valor positiu excepte {{jsxref("Number.POSITIVE_INFINITY", "POSITIVE_INFINITY")}}, és <code>NEGATIVE_INFINITY</code>.</li> + <li><code>NEGATIVE_INFINITY</code>, dividit tant per <code>NEGATIVE_INFINITY</code> com per {{jsxref("Number.POSITIVE_INFINITY", "POSITIVE_INFINITY")}}, és {{jsxref("Global_Objects/NaN", "NaN")}}.</li> + <li>Qualsevol nombre dividit per <code>NEGATIVE_INFINITY</code> és zero.</li> +</ul> + +<p>Es pot fer serivir la propietat <code>Number.NEGATIVE_INFINITY</code> per indicar una condició d'error que retorna un nombre finit en cas d'èxit. Fixeu-vos, però, que {{jsxref("Global_Objects/isFinite", "isFinite")}} seria més apropiat en aquest cas.</p> + +<h2 id="Examples" name="Examples">Exemples</h2> + +<h3 id="Exemple_Fer_servir_NEGATIVE_INFINITY">Exemple: Fer servir <code>NEGATIVE_INFINITY</code></h3> + +<p><u>En l'exemple següent, a la variable <code>smallNumber</code> se li assigna un valor que és més petit que el valor mínim. Quan la delcaració {{jsxref("Statements/if...else", "if")}} s'executa, <code>smallNumber</code> té el valor <code>-Infinity</code>, així <code>smallNumber</code> s'estableix com a un valor més manegable abans de prosseguir.</u></p> + +<pre class="brush: js notranslate">var smallNumber = (-Number.MAX_VALUE) * 2; + +if (smallNumber == Number.NEGATIVE_INFINITY) { + smallNumber = 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>1a edició de ECMAScript.</td> + <td>Estàndard</td> + <td>Definició inicial. Implementat en JavaScript 1.1.</td> + </tr> + <tr> + <td>{{SpecName('ES5.1', '#sec-15.7.3.5', 'Number.NEGATIVE_INFINITY')}}</td> + <td>{{Spec2('ES5.1')}}</td> + <td></td> + </tr> + <tr> + <td>{{SpecName('ES6', '#sec-number.negative_infinity', 'Number.NEGATIVE_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="See_also" name="See_also">Vegeu també</h2> + +<ul> + <li>{{jsxref("Number.POSITIVE_INFINITY")}}</li> + <li>{{jsxref("Number.isFinite()")}}</li> + <li>{{jsxref("Global_Objects/Infinity", "Infinity")}}</li> + <li>{{jsxref("Global_Objects/isFinite", "isFinite()")}}</li> +</ul> |
