Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



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 "Jan 10 2012" The Rockbox Crew
aaa