simple way to avoid division by zero?
Posted: Fri Feb 19, 2016 5:35 pm
I just got a bug in my program which happens because:
result = (a-b) / c
in some cases a-b might result in 0, and hence it is trying to:
0 / c
I can, and will make necessary cautions to avoid this happening, but does there happen to be some simple way, perhaps even a command that would result in 0 when division by zero happens?
result = (a-b) / c
in some cases a-b might result in 0, and hence it is trying to:
0 / c
I can, and will make necessary cautions to avoid this happening, but does there happen to be some simple way, perhaps even a command that would result in 0 when division by zero happens?