Fix zero value bug

Before whenever you had a fraction 0/1 or something, it said it was not a number (NaN), which broke various parts of my code and did not enable me to multiply by zero, even if it wasn't in the denominator. I believe this solves all possible issues, but who knows.