Re: Calculating cosinus/sinus

2013-05-12 Thread Tim Prince
On 5/12/2013 9:53 AM, Ondřej Bílka wrote: On Sun, May 12, 2013 at 02:14:31PM +0200, David Brown wrote: On 11/05/13 17:20, jacob navia wrote: Le 11/05/13 16:01, Ondřej Bílka a écrit : As 1) only way is measure that. Compile following an we will see who is rigth. cat " #include int main(){ in

Re: Calculating cosinus/sinus

2013-05-12 Thread Ondřej Bílka
On Sun, May 12, 2013 at 02:14:31PM +0200, David Brown wrote: > On 11/05/13 17:20, jacob navia wrote: > >Le 11/05/13 16:01, Ondřej Bílka a écrit : > >>As 1) only way is measure that. Compile following an we will see who is > >>rigth. > >> > >>cat " > >>#include > >> > >>int main(){ int i; > >> do

Re: Calculating cosinus/sinus

2013-05-12 Thread David Brown
On 11/05/13 17:20, jacob navia wrote: Le 11/05/13 16:01, Ondřej Bílka a écrit : As 1) only way is measure that. Compile following an we will see who is rigth. cat " #include int main(){ int i; double x=0; double ret=0; double f; for(i=0;i<1000;i++){ ret+=sin(x); x+

Re: Calculating cosinus/sinus

2013-05-11 Thread Tim Prince
On 05/11/2013 11:25 AM, Robert Dewar wrote: On 5/11/2013 11:20 AM, jacob navia wrote: OK I did a similar thing. I just compiled sin(argc) in main. The results prove that you were right. The single fsin instruction takes longer than several HUNDRED instructions (calls, jumps table lookup what ha

Re: Calculating cosinus/sinus

2013-05-11 Thread Robert Dewar
On 5/11/2013 11:20 AM, jacob navia wrote: OK I did a similar thing. I just compiled sin(argc) in main. The results prove that you were right. The single fsin instruction takes longer than several HUNDRED instructions (calls, jumps table lookup what have you) Gone are the times when an fsin woul

Re: Calculating cosinus/sinus

2013-05-11 Thread jacob navia
Le 11/05/13 16:01, Ondřej Bílka a écrit : As 1) only way is measure that. Compile following an we will see who is rigth. cat " #include int main(){ int i; double x=0; double ret=0; double f; for(i=0;i<1000;i++){ ret+=sin(x); x+=0.3; } return ret; } " > sin.c

Re: Calculating cosinus/sinus

2013-05-11 Thread Robert Dewar
On 5/11/2013 10:46 AM, Robert Dewar wrote: 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!) And of course this experiment says nothing about accuracy!

Re: Calculating cosinus/sinus

2013-05-11 Thread Robert Dewar
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 int main(){ int i; double x=0; double ret=0; double f; for(i=0;i<1000;i++){

Re: Calculating cosinus/sinus

2013-05-11 Thread Ondřej Bílka
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 fas

Re: Calculating cosinus/sinus

2013-05-11 Thread Robert Dewar
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 ma

Re: Calculating cosinus/sinus

2013-05-11 Thread jacob navia
Le 11/05/13 11:30, Marc Glisse a écrit : On Sat, 11 May 2013, jacob navia wrote: Hi When caculating the cos/sinus, gcc generates a call to a complicated routine that takes several thousand instructions to execute. Suppose the value is stored in some XMM register, say xmm0 and the result sh

Re: Calculating cosinus/sinus

2013-05-11 Thread jacob navia
Le 11/05/13 11:20, Oleg Endo a écrit : Hi, This question is not appropriate for this mailing list. Please take any further discussions to the gcc-help mailing list. On Sat, 2013-05-11 at 11:15 +0200, jacob navia wrote: Hi When caculating the cos/sinus, gcc generates a call to a complicated ro

Re: Calculating cosinus/sinus

2013-05-11 Thread Marc Glisse
On Sat, 11 May 2013, jacob navia wrote: Hi When caculating the cos/sinus, gcc generates a call to a complicated routine that takes several thousand instructions to execute. Suppose the value is stored in some XMM register, say xmm0 and the result should be in another xmm register, say xmm1.

Re: Calculating cosinus/sinus

2013-05-11 Thread Oleg Endo
Hi, This question is not appropriate for this mailing list. Please take any further discussions to the gcc-help mailing list. On Sat, 2013-05-11 at 11:15 +0200, jacob navia wrote: > Hi > > When caculating the cos/sinus, gcc generates a call to a complicated > routine that takes several thousand