Saturday, September 22, 2018

How do I print double in Python with exact precision?

I need to print double with precision equal exactly to 6, I found function round:



print(str(round(result, 6))


But in case result itself has less precision, the print function skips zeros at the end.



Gor example, the output of such code,



print(str(round(4.0, 6)))



is



4.0


But what I need is



4.000000



How can I reach this?

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...