[java] how does Math.acos() work?

Cheetoz

[H]ard|Gawd
Joined
Mar 3, 2003
Messages
1,972
I put Math.acos(0.5) and I get 1.0471975511965979

It is suppose to be 60 :confused:
 
1.0471975511965979 is pi/3, which is 60 degrees in radians.
 
Sun has amazing documentation for Java. right now, i am doing a short project for a String algorithms class in Java (building aho-corasick keyword tree. neat algorithm. look it up!).

when i don't know how something works, or if i want to see if there is something quick to do what i want to do, i google it.

in your instance, i googled "java math.acos" and the first hit was the documentation for the math class.

if i search on that page for "acos" i can click on the acos() method, which takes me to http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Math.html#acos(double)

and if you read the docs on that method, it tells you that it returns a result between 0 and Pi. if you have a math class, you know then that the result is returned in radians.

this process will help you immensely in the future.
 
I dunno anything about Java, but the mathematician in me says you have your radians and degrees all mixed up.

Remember: one radian is (pi/180) degrees.
 
Back
Top