#### Archived

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

# calculation of trigonmetric functions

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

## 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 on other sites
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 on other sites
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

##### 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.

1. 1
2. 2
Rutin
21
3. 3
4. 4
A4L
14
5. 5

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633736
• Total Posts
3013603
×