This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Calculating cosinus/sinus
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: Robert Dewar <dewar at adacore dot com>
- Cc: jacob at jacob dot remcomp dot fr, gcc at gcc dot gnu dot org, Marc Glisse <marc dot glisse at inria dot fr>
- Date: Sat, 11 May 2013 16:01:59 +0200
- Subject: Re: Calculating cosinus/sinus
- References: <518E0C29 dot 6050204 at jacob dot remcomp dot fr> <alpine dot DEB dot 2 dot 02 dot 1305111128410 dot 3954 at laptop-mg dot saclay dot inria dot fr> <518E1299 dot 80609 at jacob dot remcomp dot fr> <518E48ED dot 70603 at adacore dot com>
On Sat, May 11, 2013 at 09:34:37AM -0400, Robert Dewar wrote:
> On 5/11/2013 5:42 AM, jacob navia wrote:
>
> >1) The fsin instruction is ONE instruction! The sin routine is (at
> >least) thousand instructions!
> > Even if the fsin instruction itself is "slow" it should be thousand
> >times faster than the
> > complicated routine gcc calls.
> >2) The FPU is at 64 bits mantissa using gcc, i.e. fsin will calculate
> >with 64 bits mantissa and
> > NOT only 53 as SSE2. The fsin instruction is more precise!
>
> You are making conclusions based on naive assumptions here.
As 1) only way is measure that. Compile following an we will see who is
rigth.
cat "
#include <math.h>
int main(){ int i;
double x=0;
double ret=0;
double f;
for(i=0;i<10000000;i++){
ret+=sin(x);
x+=0.3;
}
return ret;
}
" > sin.c
gcc sin.c -O3 -lm -S
cp sin.s fsin.s
#change implementation in to fsin.s
gcc sin.s -lm -o sin; gcc fsin.s -lm -o fsin
for I in `seq 1 10` ; do
time ./sin
time ./fsin
done
> >
> >I think that gcc has a problem here. I am pointing you to this problem,
> >but please keep in mind
> >I am no newbee...
>
> Sure, but that does not mean you are familiar with the intracacies
> of accurate computation of transcendental functions!
> >
> >jacob
> >
--
Borg implants are failing