• Advertisement
Sign in to follow this  

Can dot() on two normalized vectors be greater than 1

This topic is 2706 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

Just want quickly to ask something: Can dot-product of two normalized vectors be greater than 1?

Share this post


Link to post
Share on other sites
Advertisement
The dot product can be expressed by |A|*|B|*cos(ThetaAB). |A| and |B| are both 1, and cos(ThetaAB) never exceeds 1, so the answer is "no." Of course, this is neglecting rounding error.

Share this post


Link to post
Share on other sites
If you're asking if your code needs to handle the case that the dot product is greater than 1, then the answer is yes. Floating point error can create situations when such a dot product can occur.

Share this post


Link to post
Share on other sites
Since you've been given some different answers here, let me reinforce what Rycross and no such user have said, which is that assuming some sort of floating-point representation is being used, the answer to your question is yes. If you want your code to be robust, in most cases you'll need to take this into consideration.

Share this post


Link to post
Share on other sites
Yes, just to clarify, I was specifying that mathematically it would not come out greater than 1. In practice, you will need to accommodate floating point rounding errors, which may cause the result to be greater than 1.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement