[comp.misc] checking for overflow in C

bph@buengc.BU.EDU (Blair P. Houghton) (05/10/89)

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."