Fast and Slow Operations

I have been looking around at stuff for some time, and I have found many people saying different things about the Pic Microcontroller. Some people have said that division is slow w/o hardware support, some have said that floating point operations were ridiculously painful, etc.

I am looking a for a vaguely comprehensive guide as to what mathematical operations are slow and what operations are fast. Over here, we have found an excellent approximation for cosine, which uses only square roots, multiplication, and division.

If anyone has any related info, could you please post?

Thank you.

Looking at the data sheet for the PIC18FXX20, Multiply, Add, and Subtract (8 bit integer) should be really fast. 16 bit integer versions will be not as fast, but should still be fairly fast. And it goes downhill from there. (Because all operations other than 8 bit integer Add, Subtract, and Multiply have to be implemented in software.)

also, most square root algorithms tend to be fairly slow. one thing you could try is having the robot generate a lookup table (basically an array) of the sines/cosines/tangents for each angle 0-180, and then accessing that when you need it - that way you can run the slow calculations once at startup, and use direct memory-access to get the values at runtime.