I am posting this question because I tried searching for similar questions in Stack Overflow but couldn't find one (If there is one, please provide me wit the link).
According to basic trigonometry, the cosine of 90 degrees
is 0
. However, it seems like this is not the case in Java (Is this also true for sine and other trigonometric functions?). I'm really confused about this and I am hoping someone could provide me with an easy-to-understand explanation. Thank you.
public static void main ( String args [] ) {
double radians = Math.toRadians ( 90 );
System.out.println ( Math.cos ( radians ) );
}
I should be getting 0
, but what I get when I run this code is 6.123233995736766E-17
.