Fix Mpz::rem() division by zero check

Also fix tests to catch this type of bug.

Unfortunately, I can't fix Mpf's division by zero test because AFAICS
there's currently no way to create Mpf values other than zero.