Skip to content
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

Clip input to acos() to fix nan. #3

Open
wants to merge 1 commit into
base: master
from

Conversation

@woolgathering
Copy link
Contributor

commented Aug 11, 2019

Speaking of bugs, here's one.

a = RealVector2D.newFrom([3,-2]);
b = RealVector2D.newFrom([3,-2]);
x = a.angle(b); // returns nan
x.postln; // 1.0
x == 1.0; // false
x-1; // 2.2204460492503e-16

a.angle(b) should return 0 since the two vectors are identical. There's a precision error that happens when getting the norm of the vector that puts the input of acos outside the bounds of it's acceptable input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.