Add a function for calculating exponents.