Monthly Archives: June 2009

Visual Basic 6 Round Error

I just hit an interesting error in VB6 today – it’s best described as a Visual Basic 6 round error.

I was trying to calculate a distance between two points. No problem there except I didn’t want to put something on a page that said “48.723569” miles. That would look dumb.

No problem, I thought, I’ll format the output using VB’s format command, giving the number string as “#####0.0”.

But for certain numbers, format in VB 6 kept giving me the answer 0.0. Not exactly what I was looking for…

No problem, I’ll use Round instead.

Same error. Some calculations worked, others got rounded to zero regardless… Continue reading