On Wed, 12 Jun 1996, Xaq wrote: > I need to solve this equation: > > sqrt(x^2+y^2)/(x*y) In order to check that I've read this right, that's the ratio of the length of the diagonal to the area of the rectangle where one side is x and the other is y, yes? > In the equation above, the problem is in the fact that you must add x^2 and > y^2, right there you might have a number larger than 16 bits (I am not sure > how to handle double word mult and sqrt). I even tried manipulating the If you can make any guarantees about the values that can come up you might not need a full double-word intermediate. In any event, multi-precision multiplication and division are more tedious - and slow! - than we might wish. > equation first to see if I could make it any easier. This is what I came up > with: > > sqrt( (x/y)^2 )/y This is why I want to make sure I understand the original. The rearrangement I get that's close to this is sqrt( (y/x)^2 + 1 ) --------------------- y Not that this gets us any further in finding an efficent solution, but it does raise some doubt whether I've read the same problem you started out with! > I am not sure what to do. I tried the old lookup table approach, but it > would have to be real big (255 by 255) to get any real accuracy. On top of > all that I need to keep the whole routine down to bellow 600 cycles. Any > suggestions would be a great help. No floating point, then the trigonometric form won't be of any use, will it? What was the original problem, if it's not too shy of publicity? Just possibly you've analyzed it into a form that disguises the key to a solution.