-
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIX: Fixes dot() returning NaN. #26
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for fixing this @SolarLune, can i get you to add a unit test to verify this case, just to ensure it isn't reintroduced in the future?
dcb498d
to
e2b3ea7
Compare
This seems to be due to floating point inaccuracies.
Whoops, sorry about that - OK, I force updated my master branch so the current PR now includes a simple dot NaN test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem, looks good! 👍
Excellent - and sorry for the confusing title / description, haha. This issue affects both dot() and angle(). |
Yeah, i figured that out after seeing the code. Once again thanks for the contribution! :) |
This reverts commit 007106a.
Here's a PR to fix angle() sometimes returning NaN with specific long-running vectors; this is probably due to floating-point inaccuracies.
As an example, without this PR, this:
returns NaN instead of 0 (and similarly NaN instead of
pi
if the vector were to be tested against its opposite).