I want to get large amount of accurate digits in results from divisions, such as 1/7, but Python gives different results than a high-precision calculator.
I tried the decimal library with Python 3 and tried changing its precision and rounding mode, but it gives a different result than a calculator.
from decimal import *
getcontext().prec = 40
print (Decimal(1/7))
A high-precision calculator at https://keisan.casio.com/calculator says the result is a repeating pattern of 142857, but Python's result breaks this pattern after 16 digits. Here is the number it gives:
0.142857142857142849212692681248881854116916656494140625