Have you checked the logs to see why it is becoming -1 or -2? Fixing the root cause would be a better solution.
As a workaround, I suggest to create a condition and a logicblock.
Condition would be [Your numerical variable] must be [less than] [Zero variable], where the [Zero variable] is a variable you need to define in advance with value ‘0’
Then you check the ‘Trigger Logicblocks when this condition changes’ option in the condition, and create a logicblock with that condition that, upon execution, sets your variable back to 0 using an HTTP action with the
Webhook URL to set a value for that variable.