ok that works, it compiles but doesn't work right. I'll have to work on it more. Ya I know floating point operations are not a good idea but they can't be avoided in this case, unless someone knows of a good fixed-point library.