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/number/positive_infinity | |
| 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/number/positive_infinity')
| -rw-r--r-- | files/pt-br/web/javascript/reference/global_objects/number/positive_infinity/index.html | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/files/pt-br/web/javascript/reference/global_objects/number/positive_infinity/index.html b/files/pt-br/web/javascript/reference/global_objects/number/positive_infinity/index.html new file mode 100644 index 0000000000..b6ac31f1ec --- /dev/null +++ b/files/pt-br/web/javascript/reference/global_objects/number/positive_infinity/index.html @@ -0,0 +1,92 @@ +--- +title: Number.POSITIVE_INFINITY +slug: Web/JavaScript/Reference/Global_Objects/Number/POSITIVE_INFINITY +translation_of: Web/JavaScript/Reference/Global_Objects/Number/POSITIVE_INFINITY +--- +<div>{{JSRef}}</div> + +<p>A propriedade <strong><code>Number.POSITIVE_INFINITY</code></strong> representa o valor positivo infinito.</p> + +<p>Você não precisa criar um objeto {{jsxref("Number")}} para utilizar a propriedade estática (use <code>Number.POSITIVE_INFINITY</code>).</p> + +<div>{{js_property_attributes(0, 0, 0)}}</div> + +<h2 id="Descrição">Descrição</h2> + +<p>O valor de <code>Number.POSITIVE_INFINITY</code> é o mesmo valor da propriedade {{jsxref("Infinity")}} do objeto global.</p> + +<p>Esse valor se comporta ligeiramente diferente do infinito matemático:</p> + +<ul> + <li>Qualquer valor positivo, incluindo <code>POSITIVE_INFINITY</code>, multiplicado por <code>POSITIVE_INFINITY</code> é <code>POSITIVE_INFINITY</code>.</li> + <li>Qualquer valor negativo, incluindo, {{jsxref("Number.NEGATIVE_INFINITY", "NEGATIVE_INFINITY")}}, multiplicado por <code>POSITIVE_INFINITY</code> é {{jsxref("Number.NEGATIVE_INFINITY", "NEGATIVE_INFINITY")}}.</li> + <li>Qualquer número positivo dividido por <code>POSITIVE_INFINITY</code> é Zero positivo.</li> + <li>Qualquer número negativo dividido por <code>POSITIVE_INFINITY</code> é Zero negativo.</li> + <li>Zero multiplicado por <code>POSITIVE_INFINITY</code> é {{jsxref("NaN")}}.</li> + <li>{{jsxref("Global_Objects/NaN", "NaN")}} multiplicado por <code>POSITIVE_INFINITY</code> é {{jsxref("NaN")}}.</li> + <li><code>POSITIVE_INFINITY</code>, dividido por qualquer valor negativo exceto {{jsxref("Number.NEGATIVE_INFINITY", "NEGATIVE_INFINITY")}}, é {{jsxref("Number.NEGATIVE_INFINITY", "NEGATIVE_INFINITY")}}.</li> + <li><code>POSITIVE_INFINITY</code>, dividido por qualquer valor positivo exceto <code>POSITIVE_INFINITY</code>, é <code>POSITIVE_INFINITY</code>.</li> + <li><code>POSITIVE_INFINITY</code>, dividido por {{jsxref("Number.NEGATIVE_INFINITY", "NEGATIVE_INFINITY")}} ou <code>POSITIVE_INFINITY</code>, é {{jsxref("NaN")}}.</li> +</ul> + +<p>Você pode usar a propriedade <code>Number.POSITIVE_INFINITY</code> para indicar uma condição de erro que retorna um número finito no caso de sucesso. Sobretudo, {{jsxref("isFinite")}} seria mais apropriado nesse caso.</p> + +<h2 id="Exemplos">Exemplos</h2> + +<h3 id="Usando_POSITIVE_INFINITY">Usando <code>POSITIVE_INFINITY</code></h3> + +<p>No exemplo a seguir, a variável <code>bigNumber</code> recebe um valor maior que o valor máximo. Quando as declarações {{jsxref("Statements/if...else", "if")}} executam, <code>bigNumber</code> tem o valor <code>Infinity</code>, então <code>bigNumber</code> recebe um valor mais gerenciável antes de continuar.</p> + +<pre class="brush: js">var bigNumber = Number.MAX_VALUE * 2; + +if (bigNumber == Number.POSITIVE_INFINITY) { + bigNumber = returnFinite(); +} +</pre> + +<h2 id="Especificação">Especificação</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>Initial definition. Implemented in 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> + <tr> + <td>{{SpecName('ESDraft', '#sec-number.positive_infinity', 'Number.POSITIVE_INFINITY')}}</td> + <td>{{Spec2('ESDraft')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Compatibilidade_dos_browsers">Compatibilidade dos browsers</h2> + +<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> + +<p>{{Compat("javascript.builtins.Number.POSITIVE_INFINITY")}}</p> + +<h2 id="Ver_também">Ver também</h2> + +<ul> + <li>{{jsxref("Number.NEGATIVE_INFINITY")}}</li> + <li>{{jsxref("Number.isFinite()")}}</li> + <li>{{jsxref("Infinity")}}</li> + <li>{{jsxref("isFinite", "isFinite()")}}</li> +</ul> |
