Search code examples
pythonmathdecimaldivision

calculating more the 19 digits of division


I want to make a python program that divides '1/7' in python however all I get is : 0.14285714285714285. How can I compute more digits after the decimal?


Solution

  • You should use the decimal datatype instead of float. It's in the standard library.

    There is an example of 1/7 with specified precision at the top of the decimal docs.