def _decimal_power_(base, exponent): exponent = Decimal(exponent) if exponent == Decimal('0'): return Decimal('1') elif base == Decimal('0'): return Decimal('0') else: if base >= Decimal('0'): return base**exponent else: if exponent._isinteger(): return base**exponent