Mail Archives: djgpp/1997/03/06/06:45:44
In article <331E6B93 DOT 3B63 AT comports DOT com>, j AT comports DOT com wrote:
>Anyone got a library that defines sin (sine) and cos (cosine) functions?
>
>If so, please e-mail me the appropriate includes and source code.
>
>thanks,
Hi,
Try the standard C header math.h which defines quite a few trigonometric
and other functions. Note that the trigonometric functions work on
radians not degrees!
e.g.:
-----> Cut Here <-----
#include <stdio.h>
#include <math.h>
float degreesToRadians(float angle)
{
return angle * (PI / 180);
}
main()
{
printf("Sin of 45: %f\n", sin(degreesToRadians(45)));
}
-----> CUT HERE <-----
Hope that helps
John
________________________________________________________________
Parallax Solutions Ltd. Tel.: 01203 514522
Stonecourt, Fax.: 01203 514401
Siskin Drive, Web : http://www.parallax.co.uk/~johne
Coventry CV3 4FJ Mail: johne AT parallax DOT co DOT uk
________________________________________________________________
Remember:
There is no such thing as computer error, it's 100% YOUR fault
________________________________________________________________
- Raw text -