Floating point error when calculating angle?
Jaime02 opened this issue · comments
Jaime R. commented
Code:
import numpy as np
import vg
vec1 = np.array((1, 3, 3))
vec2 = np.array((1, 3, 3))
print(vg.angle(vec1, vec2))
Expected result: 0, right?
Paul Melnikow commented
Hi, thanks for the question.
>>> import numpy as np
>>> import vg
>>> vec1 = np.array((1, 3, 3))
>>> vec2 = np.array((1, 3, 3))
>>> print(vg.angle(vec1, vec2))
1.2074182697257333e-06
That's 0.0000012 degrees which in floating-point land is pretty close to zero. What are you expecting?
Jaime R. commented
I expected to get a 0, but nevermind, I will round the result.