help with divide by zero error!!!

i am making a cheap car game in VB (don’t pay me out) and it works on my PC with win98 but when i send the compiled version to my friends with win98 they get the “divide by zero” error. it works fine in XP aswell.

can anyone help with that?

My recommendation is watch your divisions, if there is a case for divide by zero then handle it, don’t just assume things will be well.

ie.
aspect = height / width;
use this instead
aspect = (width != 0.0) ? (height / width) : 0.0;

Hope this helps, sorry I don’t know VB so no VB code
Neil

I am getting the same problem. My program works on all other computers except for a new one that I recently purchased.

Originally posted by Darkside:
[b]i am making a cheap car game in VB (don’t pay me out) and it works on my PC with win98 but when i send the compiled version to my friends with win98 they get the “divide by zero” error. it works fine in XP aswell.

can anyone help with that?[/b]

Just a guess here but different os’s handling floating point (near to zero) differently… your machine may be happy with 0.1 * 10^-30 but others may flag this as divide by zero.

Division by a floating-point zero won’t cause an exception – it will result in either ±INF or qNaN.

Make sure that your friend has the same version of the runtime DLLs that you have. Is there some difference between your Windows 98 versions (SE, SP3, etc.)? Try to eliminate any variables.

Also, with Visual C++, if you compile a program in Debug mode, all memory is initially striped (0xcdcdcdcd), but if you compile in release mode, all memory is initially zeroed (0x00000000). Visual BASIC may have similar behavior, so make sure that you initialize all variables before you use them (especially if you are running in Debug mode, and you sent your friend a Release executable).