Sign in to follow this  
B_old

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

Recommended Posts

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this