Unless your code has...oh, I don't know...EXCEPTION HANDLING?!
What a waste of education.
Unless your code has...oh, I don't know...EXCEPTION HANDLING?!
Now that's funny right there, I don't care who ya are.
The funny part is, if you divided by zero, usually the problem was getting a zero to divide with, not the fact that you want to use it in the division.
So allowing the calculation to proceed isn't helpful, what you might want to do is go back and figure out why you got a zero to begin with.
In signal processing code, they often use the NaN for this and keep going if that's what is necessary. This isn't a new concept.
When I was writing accounting software, one of the areas I had to foresee was dividing by zero. The Windows core routines will 'throw an exception' when encountering a divide-by-zero. The software program must 'catch' the 'thrown exception' and handle it in some way. I wrote elaborate error functions to catch every error we could think of, but of course, some user would always manage within 30 seconds to do something stupid. However, almost all modern software handles divide-by-zero problems gracefully.