Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23247

Precision of repr(f), str(f), print(f) when f is float

$
0
0

If I run:

>>> import math>>> print(math.pi)3.141592653589793

Then pi is printed with 16 digits,

However, according to:

>>> import sys>>> sys.float_info.dig 15

My precision is 15 digits.

So, should I rely on the last digit of that value (i.e. that the value of π indeed is 3.141592653589793nnnnnn).


Viewing all articles
Browse latest Browse all 23247

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>