At 10:11 AM 9/16/2004, Walter Banks wrote: >Good point I have rotated the problem. This doesn't cleanly solve the -1,0,1 problem. >The circular number system will solve the two number average if the negative number(s) are always normalized positive (((-179 + 360) +179) / 2) MOD 360 . This will not work for averaging three angles. It's not that hard, even in assembler. The toughest thing was the square root. For simplicity, I calculated my angles in "Dilberts". (I've defined a Dilbert as any unit that is chosen because it fits well into binary math.) There are 265 Dilberts in a circle. In the end, I convert the Dilberts to degrees. The overall accuracy of this sort of device, is only a few degrees anyway, so I don't really loose anything, and I gain tons of processing time, over trying to do it in degrees. This is a pretty good example of how working in assembler (or at least having that mindset) pushes you twoard solutions that are much easier on the machine. I'm sure it would be dead easy to code in C, but I'd hate to see the execution time. _______________________________________________ http://www.piclist.com View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist