-
Limit of an int
Hi
For my calculator i was wondering if the user inputted an extremely large number for multiplication and entered another large number and the result exceeded the limit for an unsigned int how would i make it so that the result doesn't excced it? Would i put the result on the free store or something? Thanks for all of your help.
-
Are you asking how you would detect possible arithmetic overflow before it happens?
-
Sort of, but i would like to let the user put in any number without the overflow if you understand my meaning.
-
You can try a library called GMP... it's something many here have recommended (though I have not yet personally tried it). It will allow you to handle such issues without worry.
-
Use a library designed to cope with arbitrary numbers of digits.
http://en.wikipedia.org/wiki/GNU_Mul...cision_Library