monomial: improve the pow() method to use safe operations
in case the exponent is an integral type.