Matthew Rhys-Roberts wrote: > Sean Breheny wrote: >> Just beware that you need a data type which is large enough to store x^2 >> to do this. You might be better doing c*x first and then multiplying by >> x again. That minimizes the range of values which your variables need >> to store. > > Yes. Luckily, my x is a 16 bit unsigned integer, so x^2 always fits in a > 32 bit space. I hadn't considered the benefits of working out c*x*x in > that sequence however. Yes, you always have the choice where to place the multiplications and divisions. You can also split up a division by 2^16 into two divisions by 2^8, in two different stages of the calculation. This can affect the precision of the result and the possible range of the inputs. Gerhard -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist