I am googling the question for past hour, but there are only points to Taylor Series or some sample code that is either too slow or does not compile at all. Well, most answe
This is an implementation of Taylor Series method previously given in akellehe's answer.
unsigned int Math::SIN_LOOP = 15;
unsigned int Math::COS_LOOP = 15;
// sin(x) = x - x^3/3! + x^5/5! - x^7/7! + ...
template
T Math::sin(T x)
{
T Sum = 0;
T Power = x;
T Sign = 1;
const T x2 = x * x;
T Fact = 1.0;
for (unsigned int i=1; i
T Math::cos(T x)
{
T Sum = x;
T Power = x;
T Sign = 1.0;
const T x2 = x * x;
T Fact = 1.0;
for (unsigned int i=3; i