I am working on stats for a sports team, and one of the stats I have the ratio of Shots and Shots on Target (Which I call SOTP). So, for instance, if a player has 2 shots, and one's on target, their SOTP ratio is 1/2 or 50%.
Now I have a problem that I can't seem to solve. The software that generates the stats lets me put in numbers, variables, or basic operators (+, -, /, *, and **, which represents ^). So for the SOTP I have $SOTP = SHOTSONTARGET/SHOTS$. My problem arises when a player has zero shots since the denominator is zero. If this is the case, the software automatically returns nothing, which works until I need to use the SOTP ratio in another operation. For instance, I have something that generates points based off passes, goals, etc, but when SOTP is equal to nothing, the points return nothing, even if the player has points.
So my question is, is there anything I can do to avoid the zero in the denominator by just using basic operators, constants, and variables?
Thanks for your help.
Alternative solution:
$$ \text{SOTP} = \frac{\text{shots on target}}{\text{shots} + 0^{\text{shots}}} $$ Also, if you want to set it to be $-1$ when there are no shots (as one of the comments suggested), you could have $$ \text{SOTP} = \frac{\text{shots on target}-0^{\text{shots}}}{\text{shots} + 0^{\text{shots}}} $$