Losing float precision

double realPos = 0; //Real position


for(unsigned long i = 0; i < steps; i++)
{
  realPos += (1/k);

  }

Hello? This is a really inefficient way to do a multiplication!

All the for loop does is this:

  realpos = steps/k;

I wonder if the compiler was smart enough to figure that out and optimize it anyway.

Pete