Javascript Number.EPSILON

Introduction

The Javascript Number.EPSILON property represents the difference between 1 and the smallest floating point number greater than 1.

Testing equality

console.log(Number.EPSILON);/*  w  w  w  . jav a 2 s  .  c  o  m*/
x = 0.2;
y = 0.3;
z = 0.1;

let a = Math.abs(x - y + z) < Number.EPSILON;
console.log(a);



PreviousNext

Related