I thought that myself but it doesn't seem to work. I know the arc cosine should be the inverse of cosine, but java doesn't seem to calculate it correctly. For example:

>> The result is given in radians. You need Math.toDegrees
Exactly.
From the docs:
acos returns the arc cosine of an angle, in the range of 0.0 through pi.

>> You need Math.toDegrees
But as the doc says:
The conversion from radians to degrees is generally inexact;
Users should not expect cos(toRadians(90.0)) to exactly equal 0.0.

Well not really ;-) My last comment shows you don't need to introduce any call to toRadians. You don't even need to call toDegrees if you don't want a degree result

0

Featured Post

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.