You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
358 B

def sine(deg):
deg %= 360
rad = deg * 3.14 / 180
sin = 0
-------
float sine(int deg) {
deg %= 360; // make it less than 360
float rad = deg * PI / 180;
float sin = 0;
int i;
for(i = 0; i < TERMS; i++) { // That's Taylor series!!
sin += power(-1, i) * power(rad, 2 * i + 1) / fact(2 * i + 1);
}
return sin;
}