You are not logged in.

- Topics: Active | Unanswered

**mikau****Member**- Registered: 2005-08-22
- Posts: 1,504

I'm writing some awsome programs using math but I really really really need access to sine, cosine and tangent functions, also I really could use arcsin, arccos, and arctan, but arctangent the most since I need to convert from rectangular form to polar form and back.

Someone gave me a link to the formulas for sine, cosine and tangent, which was great and they appear to work, but they call a lot of factorials and very large numbers "270^5" :-O

If anyone knows where I can get a copy of the source code for functions for sine, cosine, tangent, arcsine, etc. so I can just copy the definition into my program and call on it when I need it. It would be a MAJOR help!

A logarithm is just a misspelled algorithm.

Offline

**mikau****Member**- Registered: 2005-08-22
- Posts: 1,504

please?

A logarithm is just a misspelled algorithm.

Offline

**MathsIsFun****Administrator**- Registered: 2005-01-21
- Posts: 7,552

For performance I would use the standard include "math.h" - it has sin cos and tan.

Example:

#include <stdio.h>

#include <math.h>

#define PI 3.141592654

int main () {

double angle;

angle = 10;

double ans;

ans = sin (angle*PI/180);

printf ("Ans = %lf ", ans );

return 0;

}

Or did you need more accuracy or something?

"The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman

Offline

**mikau****Member**- Registered: 2005-08-22
- Posts: 1,504

Thats exactly what I'm looking for! :-D Thanks a yotta, Mathisfun!

A logarithm is just a misspelled algorithm.

Offline

**mikau****Member**- Registered: 2005-08-22
- Posts: 1,504

wow, sometimes please does work!

A logarithm is just a misspelled algorithm.

Offline

**mikau****Member**- Registered: 2005-08-22
- Posts: 1,504

Hey it works! Thanks again mathisfun! Are there functions for arcsin, arccos, and arctan?

A logarithm is just a misspelled algorithm.

Offline