David Smith

David Smith

  • NA
  • 2k
  • 0

DivideByZeroException exception

Nov 14 2017 2:17 AM
The offset is going to zero, can someone tell me why and help me resolve this issue. I get a DivideByZeroException exception during the loop because the offset goes to zero
 
for (int offset = 0; offset <= File.Length; offset += buffersize)
{
 
I get a DivideByZeroException exception during the loop.

totalspeed = Math.Round((offset / (sw.ElapsedMilliseconds / 1000)) * 0.00000762939453125, 1);
}

Answers (3)