1

Why do javascript return a true value if I check the following equation:

console.log(Number.MAX_VALUE === (Number.MAX_VALUE - 1)); // -> true

It doesn't matter if I add or subtract a certain value of the max value. Even a big number like 100000 will return true.

console.log(Number.MAX_VALUE === (Number.MAX_VALUE - 100000)); // -> true

I would appreciate any answer, thank you very much.

Habebit
  • 957
  • 6
  • 23
  • https://www.wikitechy.com/tutorials/javascript/what-is-javascripts-highest-integer-value-that-a-number-can-go-to-without-losing-precision – RajmondX May 08 '19 at 07:24
  • I've already read this article, but the main question was **why** ? Mathematically, the statement is totally wrong, why do Javascript have such a strange behavior? – Habebit May 08 '19 at 07:25

0 Answers0