Reputation: 679
Can anyone give me a quick tip?
For example....how would I find the sine of 90 degrees?
Upvotes: 5
Views: 23085
Reputation: 9281
The sin function in java.lang.Math expects a parameter expressed in radians.
I think you should use Math.sin(Math.toRadians(90))
Upvotes: 19
Reputation: 1038800
You could use the Math.sin function where the argument is given in radians. Example:
double result = Math.sin(Math.PI / 2.0);
Upvotes: 13
Reputation: 24261
A few tips for you:
What if you combine these two tips?
Upvotes: 5
Reputation: 383746
http://java.sun.com/j2se/1.6.0/docs/api/java/lang/Math.html
It has a sin(double)
method among other mathematical functions. It takes the angle in radian, so you'd have to do the conversion from degree. For that purpose (and others), Math also has the PI
constant.
Upvotes: 1