Case Van Horsen firstname.lastname@example.org wrote:
I don't think there is any dispute over what math.floor(inf) should return. POSIX, C99, IEEE and probably many other standards agree that inf should be returned as long as the resulting type can represent it.
I dispute that there is no dispute over what math.floot(inf) should return. ;-)
All the standards specify a result type can represent +-Inf and +-0. A standards compliant version should return +-Inf and +-0. lrint() and llrint() are defined to return long or long long, respectively. It would be fine if they raised an exception. The current math.floor() actually behaves more like llrint() than floor().
I've always found the behavior of math.floor() a bit surprising, especially since most functions in the module are thin wrappers around the C functions from math.h.
So (if we can change it) I'd prefer that floor() behaves according to the C standard.