sincos as a macro

Alexei Podtelezhnikov apodtele@mccammon.ucsd.edu
Thu Apr 22 09:23:00 GMT 2004


GSL community,

I have stumbled upon multiple occurances of

  *x = cos (t);
  *y = sin (t);

As far as I know even -ffast-math does not yet calls for fsincos i87 
instruction. I often use a dangerous macro and call gcc -DWITH_SINCOS. 

/* intentionally dangerous internal macro */
#ifndef WITH_SINCOS
# define sin_cos(si, co, x)     si = sin(x); co = cos(x)
#else
# define sin_cos(si, co, x)     asm ("fsincos" : "=t" (co), "=u" (si) : "0" (x))
#endif

or one can come up with a function. What are the plans in GSL for this 
worthy optimization?

Alexei
 






More information about the Gsl-discuss mailing list