strange behavior of execution configuration

I’ve some trouble using a simple kernel with the following execution configuration,

dim3 dimBlock =512;
dim3 dimGrid = (ceil((double)nij/512), 1);

when I launch it, after the first block (i.e. the 512th result), it doesn’t work well.
If I change it with this

dim3 dimBlock =512;
dim3 dimGrid = (ceil((double)nij/512));

it works well…
but, isn’t dim3 dimGrid x == dim3 dimGrid(x, 1, 1) ?