Updated `power_all_terms` for the case when exp is negative