This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients mark.dickinson, skrah, steven.daprano, tim.peters
Date 2014-08-14.19:42:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1408045328.69.0.957800462425.issue22198@psf.upfronthosting.co.za>
In-reply-to
Content
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 signed 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.
History
Date User Action Args
2014-08-14 19:42:08mark.dickinsonsetrecipients: + mark.dickinson, tim.peters, steven.daprano, skrah
2014-08-14 19:42:08mark.dickinsonsetmessageid: <1408045328.69.0.957800462425.issue22198@psf.upfronthosting.co.za>
2014-08-14 19:42:08mark.dickinsonlinkissue22198 messages
2014-08-14 19:42:07mark.dickinsoncreate