I'm making my own RealNumber class in Python. All four fundamental operations - Addition, Subtraction, Multiplication and Division are defined there. In case of division, user can specify up to how many digit he/she wants to calculate after the decimal place, if the Quotient is not finite.
Now, I want to define the pow() function. Suppose, I need to calculate $ a ^ b $, where $ a, b \in\mathbb{R} $.
I want to do the operation as
Let, $ y = a^b $
$ ⇒ y = e^{\ln(a^b)} $
$ ⇒ y = e^{b*\ln(a)} $
First I need to calculate the $ \ln(a) $ using Logarithm series, next I need to use the $ e^x $ series to calculate $ e^{b*\ln(a)} $.
Now, the question is, as this is my custom class, I want to specify that how many digits I want accurately after the decimal point in the final result.
Suppose, I want $n$ digits accurately after the decimal point. To do that, how many terms I need to take for those two series??