Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!rochester!pt.cs.cmu.edu!cadre!pitt!cisunx!jcbst3 From: jcbst3@cisunx.UUCP (James C. Benz) Newsgroups: comp.lang.c Subject: Re: checking for overflow in C Message-ID: <17981@cisunx.UUCP> Date: 9 May 89 16:59:44 GMT References: <13367@dartvax.Dartmouth.EDU> <10218@smoke.BRL.MIL> <436@cbnewsm.ATT.COM> Reply-To: jcbst3@unix.cis.pittsburgh.edu (James C. Benz) Organization: Univ. of Pittsburgh, Comp & Info Sys Lines: 20 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. And while we're on the subject (how's your old wazoo) - Is there any easy (or not so easy) way to check for overflow in arithmetic involving Floating Point values? I have a program with a large block of FP arithmetic that is quite prone to overflow (VERRRY large numbers) and my only recourse up to now has been to check the value of each computation against 1/2 * MAXFLOAT which is far from perfect. It would please me greatly and not surprise me much if there is a way built into the FP package to do this that my documentation just doesn't mention - not sure if I have the full set of docs anyway. I'm using ATT Sys V. -- Jim Benz jcbst3@unix.cis.pittsburgh.edu If a modem University of Pittsburgh answers, UCIR (412) 648-5930 hang up!