--- title: Number.EPSILON slug: Web/JavaScript/Reference/Global_Objects/Number/EPSILON tags: - ECMAScript 2015 - JavaScript - Number - Número - Property - Propriedade translation_of: Web/JavaScript/Reference/Global_Objects/Number/EPSILON ---
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 {{jsxref("Number")}} para acessar esta propriedade estática (use Number.EPSILON).
A propriedade EPSILON tem o valor de aproximadamente 2.2204460492503130808472633361816E-16, ou 2-52.
if (Number.EPSILON === undefined) {
Number.EPSILON = Math.pow(2, -52);
}
x = 0.2; y = 0.3; z = 0.1; equal = (Math.abs(x - y + z) < Number.EPSILON);
| Especificação |
|---|
| {{SpecName('ESDraft', '#sec-number.epsilon', 'Number.EPSILON')}} |
{{Compat("javascript.builtins.Number.EPSILON")}}