checking for overflow in C

James C. Benz jcbst3 at cisunx.UUCP
Wed May 10 02:59:44 AEST 1989


In article <436 at cbnewsm.ATT.COM> mnc at cbnewsm.ATT.COM (michael.n.condict) writes:
>In article <10218 at smoke.BRL.MIL>, gwyn at smoke.BRL.MIL (Doug Gwyn) writes:
>> In article <13367 at dartvax.Dartmouth.EDU> shallit at 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 at unix.cis.pittsburgh.edu     If a modem 
University of Pittsburgh					 answers,
UCIR			     (412) 648-5930			 hang up!



More information about the Comp.lang.c mailing list