STINNER Victor <vstin...@python.org> added the comment:

I'm not sure which kind of problem you are trying to solve here. time.time() 
does lose precision because it uses the float type. Comparing time.time() and 
time.time_ns() tricky because of that. If you care of nanosecond precision, 
avoid float whenever possible and only store time as integer.

I'm not sure how to compat time.time() float with time.time_ns(). Maybe 
math.isclose() can help.

I don't think that Python is wrong here, time.time() and time.time_ns() work 
are expected, and I don't think that time.time() result can be magically more 
accurate: 1580301619906185300 nanoseconds (int) cannot be stored exactly as 
floating point number of seconds.

I suggest to only document in time.time() is less accurate than time.time_ns().

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39484>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to