"and other arithmetic inaccuracies"...yes it is. In particular, 90 degrees = PI/2 radians, and Java cannot hold the value exactly in a floating point value. So when you take the cosine you end up with something very close to zero, instead of exactly zero.
You're taking degrees, converting to radians, which is fine, getting the cosine, which is fine, but then doing a radian ⇒ degree conversion on the cosine. That last step is trying to convert a unitless scalar into an angular measure, and that's not valid.
You're going deg ⇒ rad ⇒ scalar ⇒ deg. You'd need to add a call to Math.acos() in there for it to make sense.
Joined: Mar 09, 2012
yeah really, i didn't see it, looks like i'm tired a bit. thank you very much