The math for approximating sine is below using the Taylor series. (x3 is x to the 3rd power).
sin x = x - x3/3! + x5/5! - x7/7! + ...
http://www.homeschoolmath.net/other_top ... ulator.php
x has to be in radians. Using just the first 4 terms should give you a value accurate to 7 decimal places. You may want to also write functions for raising a value to a power (Yes, this function already exists but its in the math library, same for factorial) as well as factorial.
Code:
double sin(double x) {
return (x - ((x*x*x)/(3*2*1)) + ((x*x*x*x*x)/(5*4*3*2*1)) - ((x*x*x*x*x*x*x)/(7*6*5*4*3*2*1)));
}
The following would be a nasty quick and dirty way of approximating it using no math library functions.