Chapter 14: Problem 14
Redefine the function power so that it also works for negative exponents. In order to do this you will also have to change the type of the value returned to double. The function declaration and header comment for the redefined version of power is as follows: double power \((\text { int } x, \text { int } n)\) //Precondition: If \(n<\theta\), then \(x\) is not \(\theta\) //Returns \(x\) to the power \(n\) Hint: \(x^{-\mathrm{n}}\) is equal to \(1 /\left(x^{\mathrm{n}}\right)\)
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.