🕸📝Fergus Duniho wrote on Sat, Nov 11, 2017 04:47 PM UTC:
Noticing that the % operator was giving a division by zero error, I modified the % and mod operators in GAME Code to return the first argument when the second argument is zero. Here is my reasoning for this. x % y = x - floor(x / y) * y. Since anything times zero is zero, the value of floor(x / y) does not affect the product of floor(x / y) * y when y is zero. So, even if x/y is undefined, the final product of floor(x / y) * y should still be zero when y is zero. When this is subtracted from x, the result is x.
Noticing that the % operator was giving a division by zero error, I modified the % and mod operators in GAME Code to return the first argument when the second argument is zero. Here is my reasoning for this. x % y = x - floor(x / y) * y. Since anything times zero is zero, the value of floor(x / y) does not affect the product of floor(x / y) * y when y is zero. So, even if x/y is undefined, the final product of floor(x / y) * y should still be zero when y is zero. When this is subtracted from x, the result is x.