File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes did you know that cos(90) != 0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "did you know that cos(90) != 0" Watch "did you know that cos(90) != 0" New topic
Author

did you know that cos(90) != 0

Marlene Miller
Ranch Hand

Joined: Mar 05, 2003
Posts: 1391
Math.tan(Math.toRadians(90)) is not NaN.
Math.cos(Math.toRadians(90)) is not 0.0.

57.289961630759144
1.633123935319537E16
-57.28996163075955
1.633123935319537E16
6.123233995736766E-17
6.123233995736766E-17
PostScript: Revised output. Removed confusing labels.
[ May 18, 2003: Message edited by: Marlene Miller ]
Robbie kyodo
Ranch Hand

Joined: May 05, 2003
Posts: 97
i think we have to use toRadian first before we can do any cos, tan, sin


SCJP 2 1.4
Robbie kyodo
Ranch Hand

Joined: May 05, 2003
Posts: 97
i think we have to use toRadian first before we can do any cos, tan, sin
Marlene Miller
Ranch Hand

Joined: Mar 05, 2003
Posts: 1391
Yes, I did convert 90 degrees to radians.
Of course the conversion is an approximation to PI/2. It's a rational number. Which is why cos of 90 degrees is not 0.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: did you know that cos(90) != 0
 
Similar Threads
What operations produce NaN?
Trying to calculate lines over pi/4
tan(90) and sin(90)/cos(90)
How far am I from directly opposite the Ranch?
Math cos wth