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