File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -750,12 +750,21 @@ Decimal objects
750750
751751 .. method :: remainder_near(other[, context])
752752
753- Compute the modulo as either a positive or negative value depending on
754- which is closest to zero. For instance, ``Decimal(10).remainder_near(6) ``
755- returns ``Decimal('-2') `` which is closer to zero than ``Decimal('4') ``.
756-
757- If both are equally close, the one chosen will have the same sign as
758- *self *.
753+ Return the remainder from dividing *self * by *other *. This differs from
754+ ``self % other `` in that the sign of the remainder is chosen so as to
755+ minimize its absolute value. More precisely, the return value is
756+ ``self - n * other `` where ``n `` is the integer nearest to the exact
757+ value of ``self / other ``, and if two integers are equally near then the
758+ even one is chosen.
759+
760+ If the result is zero then its sign will be the sign of *self *.
761+
762+ >>> Decimal(18 ).remainder_near(Decimal(10 ))
763+ Decimal('-2')
764+ >>> Decimal(25 ).remainder_near(Decimal(10 ))
765+ Decimal('5')
766+ >>> Decimal(35 ).remainder_near(Decimal(10 ))
767+ Decimal('-5')
759768
760769 .. method :: rotate(other[, context])
761770
You can’t perform that action at this time.
0 commit comments