Integer division will never produce anything more precise than zero. Try casting either iElapsedYah or iNumTimes to double, you'll probably get better results.