pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Number/EPSILON

pt>

Esta página foi traduzida do inglês pela comunidade. Saiba mais e junte-se à comunidade MDN Web Docs.

View in English Always switch to English

Number.EPSILON

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since setembro de 2015.

A propriedade Number.EPSILON representa a diferença entre 1 e o menor ponto flutuante maior que 1.

Você não tem que criar um objeto Number para acessar esta propriedade estática (use Number.EPSILON).

Experimente

const result = Math.abs(0.2 - 0.3 + 0.1);

console.log(result);
// Expected output: 2.7755575615628914e-17

console.log(result < Number.EPSILON);
// Expected output: true
Property attributes of Number.EPSILON
Writableno
Enumerableno
Configurableno

Descrição

A propriedade EPSILON tem o valor de aproximadamente 2.2204460492503130808472633361816E-16, ou 2-52.

Polyfill

js
if (Number.EPSILON === undefined) {
  Number.EPSILON = Math.pow(2, -52);
}

Exemplos

Testando igualdade

js
x = 0.2;
y = 0.3;
z = 0.1;
equal = Math.abs(x - y + z) < Number.EPSILON;

Especificações

Specification
ECMAScript® 2027 Language Specification
# sec-number.epsilon

Compatibilidade com navegadores

Veja também

  • O objeto Number que esta propriedade pertence.
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy