Mark Dickinson added the comment: Steven: there's a set of (unwritten) rules for how the IEEE 754 operations work. (I think they actually *were* articulated explicitly in some of the 754r drafts, but didn't make it into the final version.) One of them is that ideally, a floating-point operations works as though the corresponding mathematical operation were performed exactly on the inputs (considered as real numbers), followed by a rounding step that takes the resulting real number and rounds it to the nearest floating-point number. This is how essentially *all* the operations prescribed in IEEE 754 behave, with a greater or lesser amount of hand-waving when it comes to specifying results for special cases like infinities and nans. In this case, the underlying mathematical operation is `x, y -> floor(x / y)`. The only tricky point is the extension to infinity, but we've got the existing behaviour of regular division to guide us there - the result of dividing a finite value by an infinity is an appropriately signe d zero. So there's really not a lot of room for manoeuvre in an IEEE 754-like operation.
> The alternative is a discontinuity, where -0.5//x = -1 for all finite > but huge x and then suddenly 0 when x overflows to infinity. That's > probably a bad idea. Shrug: the underlying mathematical operation is discontinuous; I really don't see a problem here. In any case, if you're worried about discontinuities, what about the one that occurs between positive values and negative values of x in the current implementation (a jump from 0 to -1)? Continuity takes second place to correctness here. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22198> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com