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



Rockbox mail archive

Subject: Re: Sinus and cosinus functions

Re: Sinus and cosinus functions

From: Damien Teney <dteney_at_hotmail.com>
Date: Sun, 01 Sep 2002 12:47:24 +0200

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
Received on 2002-09-01

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy