Xref: utzoo comp.lang.c:18564 comp.misc:6049 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ukma!husc6!bu-cs!buengc!bph From: bph@buengc.BU.EDU (Blair P. Houghton) Newsgroups: comp.lang.c,comp.misc Subject: Re: checking for overflow in C Message-ID: <2817@buengc.BU.EDU> Date: 10 May 89 10:56:12 GMT References: <13367@dartvax.Dartmouth.EDU> <10218@smoke.BRL.MIL> <436@cbnewsm.ATT.COM> <17981@cisunx.UUCP> Reply-To: bph@buengc.bu.edu (Blair P. Houghton) Followup-To: comp.misc Organization: Boston Univ. Col. of Eng. Lines: 15 In article <17981@cisunx.UUCP> jcbst3@unix.cis.pittsburgh.edu (James C. Benz) writes: >In article <436@cbnewsm.ATT.COM> mnc@cbnewsm.ATT.COM (michael.n.condict) writes: >>In article <10218@smoke.BRL.MIL>, gwyn@smoke.BRL.MIL (Doug Gwyn) writes: >>>In article <13367@dartvax.Dartmouth.EDU> shallit@eleazar.dartmouth.edu (Jeffrey Shallit) writes: >>>>... enlighten me about the officially approved way of checking >>>>overflow when multiplying two integers. [...much dancing deleted...] I know it's overhead-city, but could someone try taking logarithms, adding them, and checking them against the logarithm of the maximum-allowable number? --Blair "Yeah, but except for the last couple of bits, it's idiot-proofed."