Division by zero

Blitz3D Forums/Blitz3D Programming/Division by zero

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I have several places in my current code (when scaling etc.) where it's possible a division by zero could occur.

Now, Blitz3D throws a division by zero error when using a constant zero (a# = b# / 0.0), but when using a variable as the divisor, B3D seems to handle the situation by returning a value of 'Infinity', and not ending the program with an error.

Is this situation guaranteed when dividing using a variable, or could my program still fail at some point with a division by zero error?

Also, the resultant 'Infinity' value is approximately equivalent to zero, right? I mean, if I scale an entity with it, it becomes invisible.

Anyone set my mind at rest on this as I'd prefer to not have to check for division by zero in-code. :)

Thanks.