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.