I am attempting to write a Python program which will produce an approximation for e using a Taylor series to a user-defined length (e.g. 100 decimal places) and print all 100 digits. However, the output is never longer than 15 decimal places, which is python's default precision for numpy.e. How could I resolve this? Below is the code I was using.
import math
precision = int(input("Number of decimal places = "))
e = 0
s = 1
i = 1
while s > (10**(-1*precision)):
e = e + s
s = 1/math.factorial(i) # e = 1 + 1/1! + 1/2! + 1/3! + ...
i = i + 1
print(e)