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: Paul Suade <paul.suade_at_laposte.net>
Date: Sun, 1 Sep 2002 14:35:42 +0200

SH1 has no float point unit, so you'd better avoid this soultion. And still
it is intolerable since it needs to multiply and divide in a loop.

----- Original Message -----
From: "Damien Teney" <dteney_at_hotmail.com>
To: <rockbox_at_cool.haxx.se>
Sent: Sunday, September 01, 2002 12:47 PM
Subject: Re: Sinus and cosinus functions


> 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