Rockbox mail archive
Subject: Re: Sinus and cosinus functions
From: Damien Teney (dteney_at_hotmail.com)
Date: 2002-09-01
I've rewritten the sinus (sin()) function. It really calculates the sinus,
without using tables. However, I don't know how fast it is, and I haven't
tried it on my Archos.
If someone could do it... ;-)
-------------------------
D a m i e n T e n e y
dteney_at_hotmail.com
http://www.mcarsweb.com
-------------------------
float fabs(float x)
{
return x >= 0 ? x: x*(-1);
}
float sin(float x)
{
float sum, x_quadrat, rest;
int k;
k = 0;
sum = 0;
rest = x;
x_quadrat = x*x;
while (fabs(rest) > 1e-9) {
sum += rest;
k += 2;
rest *= -x_quadrat/(k*(k+1));
}
return sum;
}
_________________________________________________________________
Discutez en ligne avec vos amis ! http://messenger.msn.fr
Page was last modified "Mar 9 2008" The Rockbox Crew
|