[issue29962] Add math.remainder operation

2017-04-05 Thread Mark Dickinson
Changes by Mark Dickinson : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue29962] Add math.remainder operation

2017-04-05 Thread Mark Dickinson
Mark Dickinson added the comment: New changeset a0ce375e10b50f7606cb86b072fed7d8cd574fe7 by Mark Dickinson in branch 'master': bpo-29962: add math.remainder (#950) https://github.com/python/cpython/commit/a0ce375e10b50f7606cb86b072fed7d8cd574fe7 --

[issue29962] Add math.remainder operation

2017-04-01 Thread Raymond Hettinger
Raymond Hettinger added the comment: > I'd prefer to keep the name that's consistent with both C and IEEE 754. +1 Also, the decimal module names are a poor guide. Its usability has been impaired by opaque naming (i.e. needing to use quantize() when you want to round to a fixed number of

[issue29962] Add math.remainder operation

2017-04-01 Thread Mark Dickinson
Mark Dickinson added the comment: FTR, I don't have strong opinions on the name: I could be persuaded by any of `remainder`, `remainder_near` or `ieee_remainder`. I find `ieee_remainder` somewhat more informative than `remainder_near`. -- ___

[issue29962] Add math.remainder operation

2017-04-01 Thread Mark Dickinson
Mark Dickinson added the comment: > In many cases the function that returns the nearest integer quotient is > useful. Agreed, but I'd like to keep the scope of this issue small for now: we're simply wrapping / implementing another C99 math.h function. --

[issue29962] Add math.remainder operation

2017-04-01 Thread Mark Dickinson
Mark Dickinson added the comment: > Shouldn't the new function be named math.remainder_near? Not clear. :-) I'd prefer to keep the name that's consistent with both C and IEEE 754. (We already have plenty of naming differences between Decimal and math; attempting to reconcile them is likely

[issue29962] Add math.remainder operation

2017-04-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See also Decimal.remainder_near and _PyLong_DivmodNear. Shouldn't the new function be named math.remainder_near? In many cases the function that returns the nearest integer quotient is useful. See Fraction.__round__, datetime._divide_and_round,

[issue29962] Add math.remainder operation

2017-04-01 Thread Mark Dickinson
Changes by Mark Dickinson : -- pull_requests: +1132 ___ Python tracker ___ ___

[issue29962] Add math.remainder operation

2017-04-01 Thread Mark Dickinson
New submission from Mark Dickinson: IEEE 754, the C99 standard, the Decimal IBM standard and Java all support/specify a 'remainder-near' operation. Apart from being standard, this has a number of useful applications: 1. Argument reduction in numerical algorithms: it's common to want to reduce