Archived

This topic is now archived and is closed to further replies.

Guest Anonymous Poster

Costly Operations - how do you determine the expense?

This topic is 6630 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

For that example, we don't convert to unit vectors before every single calculation, we do it once at startup, and then reuse the unit vectors. A couple squareroots once is trivial.

Generally, mathematical operations are ordered as follows, from most costly to least

FP SquareRoot
FP Divide
Integer Multiply
FP Multiply
FP Add
Integer Add, Subtract, logical operations (AND, OR, NOT, etc.)

But the PPro and above (and Pentium?) can execute integer code while it's doing the costly, long latency floating point multiplies and adds, giving these operations an effective execution time of a single cycle.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
How do you know how costly an operation is? In response to my last question on unit vectors, the response was that we use unit vectors to avoid costly divides, but to me it seems as though it would be equally costly if not more so to convert vectors to unit vectors using square roots. Any general help would be greatly appreciated.

thanks

Share this post


Link to post
Share on other sites