checking for overflow in C

Herman Rubin cik at l.cc.purdue.edu
Mon May 8 23:55:35 AEST 1989


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.
> 
> Patient:  Doctor, it hurts when I do this.
> Doctor:  Don't do that!
> 
> You're looking for tactics when what is needed is better strategy.
> How did you get your algorithm into the state where an overflow is
> even possible?  Sounds to me like the algorithm needs to be better
> engineered.


Are you that certain that the algorithm using overflow is not better
engineered than the one that does not?  By better engineered, I mean
that it runs faster.  If it is on the machine, it should be available
for use.
-- 
Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907
Phone: (317)494-6054
hrubin at l.cc.purdue.edu (Internet, bitnet, UUCP)



More information about the Comp.lang.c mailing list