I have a global function as follows:

```
__global__ void sort(float* D,  float* new_D)
{
        int  i  = threadIdx.x + blockIdx.x * blockDim.x ;   // i>=0 && i<N

        new_D[ 4*(i/4)+i%2]   = D[ 4*(i/4)+2*(i%2) ];
}

```

And it's called like this:

> 
> sort<<<(N/threadperblock),threadperblock>>>(D,new\_D);
> 
> 
> 

The function operates incorrectly when I define "N" more than 2048 in single precision,
and 4096 in double precision as I get wrong answers. What's going wrong?