I know a lot can be optimized, but unfortunately it's not one of my strong points. :) I tried to rewrite the formula, but none of the other forms gave me anything that was more efficient computationally. The formula calculates acceleration, measured by a digital accelerometer. The T1's en T2's are intervals whose variation is a measure of acceleration, relative to calibrated measurements as T1Cal (ZCal) and T2Cal. So a division like T2/T2Cal will always be close to 1. The output y is a measure for the acceleration. This will later be used in arcsin, sin and cos calculations. The result of those are arctan'ed; that's why I need precision. The range of the variables is about 0-20000, so their product is 4x10^8 worst case. which is pretty much 32bit for my taste (ok it's 29, or 30 with sign; close 'nuff :)). Anyway, y is always between -2 and +2. I do believe I need floats, but I may be mistaken. Martijn Scott Dattalo wrote: > On Thu, 5 Jun 2003, Martijn van Aartrijk wrote: > > >>Unfortunately, yes, I need the precision for more trig math later on. > > > Are you sure? The formula you posted can be optimized to get rid of 32-bit > arithmetic. However, depending on relative magnitudes of the variables, > the overall result could be less than 1. This may falsely lead you to > believe that floating point arithmetic is necessary. > > I think before we can help, we need to know 1) the magnitude of the > variables 2) what (exactly) the output of the formula is for. You mention > trig stuff, but is it arctan, sine, or what? > > When it comes to math, there are many ways to optimize... > > Scott -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu