This is for that rare breed interested in how to compute sine and cosine with pencil and paper. Precision matches that of a float type variable.
#constant Degtorad 0.017453292519943295769236907684886
function Factorial(n as integer)
retvalue as integer
retvalue = 1
for i = 2 to n
retvalue = retvalue * i
next i
endfunction retvalue
function ComputeCosine(ang as float)
retvalue as float
ang = ang * Degtorad
retvalue = 1 - ang^2 / Factorial(2) + ang^4 / Factorial(4) - ang^6 / Factorial(6) + ang^8 / Factorial(8) - ang^10 / Factorial(10)
endfunction retvalue
function ComputeSine(ang as float)
retvalue as float
ang = ang * Degtorad
retvalue = ang - ang^3 / Factorial(3) + ang^5 / Factorial(5) - ang^7 / Factorial(7) + ang^9 / Factorial(9) - ang^11 / Factorial(11)
endfunction retvalue