This is WAAAAAAAAAYYYYY better than in Oblivion:
If actor.isincombat > 0 && actor.isincombat < 0
If 1 == 3
x = 1/0
endif
endif
EVEN THAT would STILL CTD in Oblivion! I had to go thru hundreds of my scripts from 6 years of mods to check /0 errors once I discovered that in Oblivion.
If x > 0
z = y/x
endif
I had to change to:
z = y/(x+0.001)
To stop the CTD in Oblivion. Not a great way to deal with it but there was no way I was going to rework hundreds of my scripts at that point.
Dividing by zero in Papyrus seems to always return the value 1. I currently have a script where some trigonometry is used, and sometimes one of the variables is zero which messes up the results. I do not want the result to be 1 in that case, but rather just have no effect at all, i.e. 36 / 0 returns 36.
What I'm curious about is if there is any other way to handle this except for checking if variables are 0 before calculation takes place and if a var is 0 doing a different set of calculations.
Is this a common problem in programming and how is it usually handled?