[Python-Dev] Floor division (original) (raw)

Tim Peters tim.peters at gmail.com
Fri Jan 26 03:38:58 CET 2007


...

[Tim]

fractional part of x == fmod(x, 1.0) == modf(x)[0], so you could use either.

[Anders J. Munch]

Actually, on the off chance that time.time() is negative, he can use neither. It has to be math.ceil, float.mod or divmod.

If time.time() is negative, I expect this would be the least of his worries :-)

Even on most Unixish boxes, Python's time.time() is immune to "the year 2038 problem" anyway, since it uses POSIX's gettimeofday() instead of C's time() when it can.



More information about the Python-Dev mailing list