Anticipate factorial overflow

Posted by Flavius on Stack Overflow See other posts from Stack Overflow or by Flavius
Published on 2010-06-06T21:50:23Z Indexed on 2010/06/06 21:52 UTC
Read the original article Hit count: 363

Filed under:
|

Hi

I'm wondering how I could anticipate that the next iteration will generate an integer overflow while calculating the factorial F. Let's say that at each iteration I have an int I and the maximum value is MAX_INT.

It sounds like a homework, I know. It's not. It's just me asking myself "stupid" questions.

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about algorithm-design