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.

2
  • 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 :). Commented Jan 24, 2015 at 10:43
  • 1
    This question might be already solved here stackoverflow.com/questions/19054891/… Commented Jan 24, 2015 at 10:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.