__sinf and __cosf errors Minimizing errors

I’m experiencing errors for the __sinf and __cosf functions when the input arguments are large…

From my understanding of the programming guide the arguments should be within [0, 2pi] to give good results… Is this true?

I tried fixing this by:

float arg = theta[tid];

	int n =  arg/two_pi;

	float remainder = arg - float(n)*two_pi;

	output[tid] = __sinf(remainder);

But it didn’t help. Thanks!

//james

I’m experiencing errors for the __sinf and __cosf functions when the input arguments are large…

From my understanding of the programming guide the arguments should be within [0, 2pi] to give good results… Is this true?

I tried fixing this by:

float arg = theta[tid];

	int n =  arg/two_pi;

	float remainder = arg - float(n)*two_pi;

	output[tid] = __sinf(remainder);

But it didn’t help. Thanks!

//james

I read the programming guide as saying that the argument should be within [-pi, pi]. Maybe you get better results that way.

What keeps you from using [font=“Courier New”]sinf()[/font] and [font=“Courier New”]cosf()[/font]? I would assume that some thought has gone into their argument reduction code, so they will probably work better than any ad-hoc solution.

I read the programming guide as saying that the argument should be within [-pi, pi]. Maybe you get better results that way.

What keeps you from using [font=“Courier New”]sinf()[/font] and [font=“Courier New”]cosf()[/font]? I would assume that some thought has gone into their argument reduction code, so they will probably work better than any ad-hoc solution.

You are right it should be [-pi, pi]. I wished to use the __sinf for increased performance while trying to bring down the error.

Perhaps I should just stick with the sinf() at the cost of longer computational time.

You are right it should be [-pi, pi]. I wished to use the __sinf for increased performance while trying to bring down the error.

Perhaps I should just stick with the sinf() at the cost of longer computational time.