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
currently there's no way to create Mpf values other than zero.