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 always multiply instead of dividing... So if you want to make something half size use x * .5 rather than x / 2.

Using this method you will never get division by 0 and multiplying by 0 gives a result of 0 safely.
That's a neat solution when you know the divisor, but what about a situation like this? :
ratio# = mesh_height# / mesh_width#

What you're getting is Nan = Not a number. In my opinion it's best to avoid all divisions by 0. While you may not get a MAV strange & unexpected things can start happening.
Hmm, is Infinity the same as NaN? When I print the value it says 'Infinity' not NaN. I know using NaN can cause weird things but I haven't noticed anything odd during testing. It almost seems as Infinity is treated as an extremely small fraction, which is basically what I want. :)