calculation of trigonmetric functions

Started by
2 comments, last by Austrian Coder 20 years, 8 months ago
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]
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?
I hope there''ll be some benefit. I think SSE, [SSE2,] MMX and 3DNow are some nice extras.

I will wirte the sse version of sin and then i will see it
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.
Zorx (a Puzzle Bobble clone)Discontinuity (an animation system for POV-Ray)

This topic is closed to new replies.

Advertisement