Quick Speed Question

Here’s kind of a dumb quick question, I’m playing around with some vector math for my engine, and I’m seeing places where I have choices to use Trig or straight algebra…(mostly to calculate distances and vector components)

Well, here’s the question: Is it generally faster and better to perform trig functions like sin and cos, or to perform square roots? (Is there any hardware acceleration involved in either of them?) I know that square roots are slow, but they may be a necessary evil in calculating distances…

Does anybody have any suggestions about this?
(Oh yeah, sorry that this isn’t directly OpenGL realated)


Square roots can be quite speedy if you approximate them with either a look up table, or a SIMD implementation (SSE or 3DNow for example). Look on the advanced OpenGL coding forum for a current thread related to this topic.