In js, Number.MAX_VALUE represents the maximum value that can be represented. If this value is exceeded, Infinity will appear, but my calculation below is difficult to understand
(Number.MAX_VALUE+123)==Number.MAX_VALUE //true why?
(Number.MAX_VALUE+Number.MAX_VALUE)==Number.MAX_VALUE //false why?
console.log(5.3e-324) //5e-324 why?
Who understands why this is? Can you explain it?
Because 123 is too small to change the high-digit expression
Because Number.MAX_VALUE is large enough to change the expression of high digits
5.3e-324 of .3 is too small
Summary: In many cases, js will have difficulty ensuring the accuracy of floating point number calculations, such as 0.1 + 0.2 != 0.3 // true
One hundred million plus one, after rounding, it is still one hundred million, which is almost the same truth. It’s not that precise
It should just represent a numerical value. If the minus sign is separated from the number, it cannot be calculated
by Mistalis from stackoverflow
something about Number.MAX_VALUE
说白了就是浮点数精度问题!