Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

sin and cos in java

807591May 16 2008 — edited May 16 2008
Replacing these calls
Math.cos(theta)
and
Math.sin(theta)

with something like this:

-Math.cos(theta % Math.PI - Math.PI)
and
-Math.sin(theta % Math.PI - Math.PI)

makes it much faster. Why is that? Any explanation?

Also, is there any trick to make sqrt method faster like the above trick does with cos and sin
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 13 2008
Added on May 16 2008
31 comments
625 views