Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!mcgill-vision!snorkelwacker!husc6!encore!pinocchio.encore.com From: jkenton@pinocchio.encore.com (Jeff Kenton) Newsgroups: comp.sys.m88k Subject: Re: Fixed point multiply overflow detection Message-ID: <12439@encore.Encore.COM> Date: 9 Aug 90 19:23:41 GMT References: <12425@encore.Encore.COM> Sender: news@Encore.COM Lines: 26 From article <12425@encore.Encore.COM>, I wrote: > > The hardware doesn't provide any direct way (as you've noticed). Two choices > come to mind: > > * use floating point (double precision for enough accuracy) > and check the results. > > * use ff1 instructions to find the magnitude of both operands > to see if overflow can occur. > Two more things come to mind on this subject: * If you use "ff1" instructions to see how big your arguments are, you discover that there is an indeterminate case where the answer is at least 2^31 but might be > 2^32. You can't tell for sure without doing as much work as the multiply. * Depending on the details of your problem, there may be a way to condition your values so that overflow can't occur. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - jeff kenton --- temporarily at jkenton@pinocchio.encore.com --- always at (617) 894-4508 --- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -