Jump to content

View more

Image of the Day

Boxes as reward for our ranking mode. ヾ(☆▽☆)
#indiedev #gamedev #gameart #screenshotsaturday https://t.co/ALF1InmM7K
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Costly Operations - how do you determine the expense?

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
1 reply to this topic

#1 Anonymous Poster_Anonymous Poster_*   Guests   

Likes

Posted 18 October 1999 - 05:40 AM

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


#2 mhkrause   Members   

122
Like
Likes
Like

Posted 18 October 1999 - 05:40 AM

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.





Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.