Floating point problem
Peter Otten
__peter__ at web.de
Fri Apr 17 08:13:20 EDT 2020
Aakash Jana wrote:
> I am running python 3.8 only but my issue is I need more zeroes after my
> result.
> I want 2/5 = 0.400000
> But I am only getting 0.4
This is either a formatting problem
>>> value = 0.4
>>> print(f"{value:10.6f}")
0.400000
or -- if you want to *calculate* with a fixed precision -- the job for a
specialist library:
https://docs.python.org/3/library/decimal.html
More information about the Python-list
mailing list