1

Yesterday while learning Javascript i came accross some statement like "Overflow is when the number is larger than the maximum positive number that can be represented(+Infinity) and when the number is larger than the maximum negative number that can be represented(-Infinity))

Then why Number.Max_Value+1 is not giving me +Infinity and why Number.Min_Value-1 is not giving me -Infinity.`

However Number.MaxValue*2 gives me Infinity. Please help me in this. I have gone through other stackoverflow posts also but i'm unable to find an answer please help me in this confusion.

user2485435
  • 125
  • 9
  • Hey there that is a good question. Although I think it is because if you add + 1 the number is still "representable" but javascript will not show the change anymore. If you do *2 the number becomes extremely larger and javascript cannot handle this anymore. However if you do `Number.MAX_VALUE*1.00000000000000000000000000000000000000000002` Javascript returns also a value, which I guess is still somehow in range :). – Michelangelo Jan 24 '15 at 10:43
  • 1
    This question might be already solved here http://stackoverflow.com/questions/19054891/does-javascript-handle-integer-overflow-and-underflow-if-yes-how – Marc Manzano Jan 24 '15 at 10:46

0 Answers0