×

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

 0 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 ?? asked 25 Nov '18, 15:38 19●5 accept rate: 0%

 1 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 26●1 accept rate: 100% Thanks A Lot ! @ucntstopme (25 Nov '18, 17:15)
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• 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:

×1,901
×21
×20

question asked: 25 Nov '18, 15:38

question was seen: 68 times

last updated: 25 Nov '18, 17:15