Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Austrian Coder

calculation of trigonmetric functions

This topic is 5514 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello! How are functions like sin, cos, tan calculated? I want to code version of trigonmetric functions for SSE, 3DNow, MMX,... Are there some ready to use functions aviable for the different cups and their features? Thanks, Christian [edited by - Austrian Coder on August 16, 2003 8:12:45 PM]

Share this post


Link to post
Share on other sites
Advertisement
Sin and cos can be calculated as:

sin(x) = x - x^3/3! + x^5/5! - x^7/7! + x^9/9! - ...
cos(x) = 1 - x^2/2! + x^4/4! - x^6/6! + x^8/8! - ...

Tan is a little harder; try here.

On the IA-32, you''ll only need FPU instructions such as FSIN and FCOS, which is what sin() and cos() use. Are you sure that there''ll be some benefit in writing your own functions?

Share this post


Link to post
Share on other sites
cos(x)=sin(x+90degrees)
tan(x)=sin(x)/cos(x)
I''m sure you knew that, but my point is that you can just write one of the functions (using Beer Hunter''s code) and then use my little thing to do the rest. The longer you continue the ... the more accurate it will be.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!