You are not logged in. Please login at to post your questions!


What Actually Happens when I try to store Data exceeding the Limit.

I noticed something that when I tried printing factorial of number whose value was out of bounds of the data type ; It displayed zeros continously when i gave the print command ! For instance , factorial of 100 ;

Why doesn't the compiler rather shows an Error that the data you are trying to store is excceeding the limit ??

Problem :

Solution :

asked 25 Nov '18, 15:38

prembharwani's gravatar image

accept rate: 0%

When the number goes out of bounds, for eg, let the range of integers be -1000 to 1000, inclusive. If you store 1001, then it will take value -1000. If you store 1002, it takes value -999. This is what actually happens. You might be getting 100! as 0. This is because, while computing 100!, number went out of bounds and took the value 0 (precisely, 34! is saved as 0). Now any number multiplied by 0 is 0. So all factorials>=34 will give 0 as answer, and you might be wondering the reason why.


answered 25 Nov '18, 16:57

ucntstopme's gravatar image

accept rate: 100%

Thanks A Lot ! @ucntstopme

(25 Nov '18, 17:15) prembharwani2★
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 25 Nov '18, 15:38

question was seen: 68 times

last updated: 25 Nov '18, 17:15