Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!bu-cs!dartvax!eleazar.dartmouth.edu!shallit From: shallit@eleazar.dartmouth.edu (Jeffrey Shallit) Newsgroups: comp.lang.c Subject: checking for overflow in C Message-ID: <13367@dartvax.Dartmouth.EDU> Date: 5 May 89 16:30:58 GMT Sender: news@dartvax.Dartmouth.EDU Reply-To: shallit@eleazar.dartmouth.edu (Jeffrey Shallit) Organization: Dartmouth College, Hanover, NH Lines: 9 Fans of C frequently boast that it is "very close to the machine". Since I'm a relative newcomer to the language, perhaps someone could enlighten me about the officially approved way of checking overflow when multiplying two integers. Or is doing (i) a pre-multiply test to ensure the arguments aren't too big or (ii) a post-division step to ensure the accuracy of the result the only portable way of doing this? Jeff Shallit shallit@dartmouth.edu