I'm going to through a list of coordinates and computing the angle between every two adjacent lines. In other words, I'm computing an angle for every 3 consecutive points. Every three consecutive points should form a triangle (where all 3 points are pairwise distinct). In computing their angle, I use the law of cosines and therefore compute
$\gamma = \arccos(\frac{a^2 + b^2 - c^2}{2ab})$
In the process of doing this, I end up with $\frac{a^2 + b^2 - c^2}{2ab} < -1$, which means the inverse cosine has a domain error.
What is flawed about what I am doing?
I do not believe all 3 points lie on the same line, but I will check this.