This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Calculating cosinus/sinus



As 1) only way is measure that. Compile following an we will see who is
rigth.

Right, probably you should have done that before posting
anything! (I leave the experiment up to you!)

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




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]