一、Number.EPSILON
Number.EPSILON 是Javascript表示的最小精度,EPSILON 属性值接近于 2.220446049250313e-16
console.log(0.2 + 0.1)
function equal(a,b){
if(Math.abs(a-b) < Number.EPSILON){
return true
}else{
return false
}
}
console.log(equal(0.1+0.2,0.3)) // true