Work around gmp overflow error by checking limits ourselves and erroring