Performance of tables slower than built in?

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Fri May 24 10:29:11 UTC 2019


On Wednesday, 22 May 2019 at 00:22:09 UTC, JS wrote:
> 	for(int i = 0; i < res; i++)
> 		QuarterSinTab[i] = sin(PI*(i/cast(double)res));	

Btw, I think this creates a half sine, not a quarter, so you want 
(?):

      QuarterSinTab[i] = sin(PI*(0.5*i/cast(double)res));

> 	QuarterSinTab[$-1] = QuarterSinTab[0];

This creates a discontinuity if you create a quarter sine, in 
that case you probably wanted:

        QuarterSinTab[$-1] = sin(PI*0.5)

Otherwise you will never get 1 or -1.

But none of these affect performance.



More information about the Digitalmars-d-learn mailing list