At 08:51 AM 11/9/00 -0500, M. Adam Davis wrote: >I'm somewhat confused... You want the ratio of A to B (ratio = A/B) and >you are instead using the equation ratio = (A+B)/B ? > >-Adam > >Dwayne Reid wrote: > > > > Good day to all. > > > > I've got another little challenge to throw out: I have 2 - 9 bit numbers > > that I need to find the ratio of, where the ratio is expressed as a number > > from 00 to FF. > > > > Its the usual thing: x = (remainder of) (a+b) / b and I'm doing it with > > the standard 16 bit divide routines. But I figure there has to be an > > easier / shorter / quicker method. You are right - I wrote in a confusing manner. I have 2 quantities, where a goes increases when b decreases, similar to the wiper on a pot. In effect, I want to find the position of the wiper expressed as a number from 00 to FF. One other thing: since a + b is a constant, the sum of the two will also fit in 9 bits. Like I said, I am using a relatively clunky 16 bit divide routine that I'd really like to optimise for 9 bits. I've already modified it to use only 9 shifts / iterations instead of 16 but I can't help think that there is a better way. dwayne Dwayne Reid Trinity Electronics Systems Ltd Edmonton, AB, CANADA (780) 489-3199 voice (780) 487-6397 fax Celebrating 16 years of Engineering Innovation (1984 - 2000) * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Do NOT send unsolicited commercial email to this email address. This message neither grants consent to receive unsolicited commercial email nor is intended to solicit commercial email. -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics