Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
89e8f540
Commit
89e8f540
authored
Oct 31, 2012
by
Mark Dickinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #16348: Fix incorrect documentation for Decimal.remainder_near.
parent
47fa4d54
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
Doc/library/decimal.rst
Doc/library/decimal.rst
+15
-6
No files found.
Doc/library/decimal.rst
View file @
89e8f540
...
...
@@ -802,12 +802,21 @@ Decimal objects
.. method:: remainder_near(other[, context])
Compute the modulo as either a positive or negative value depending on
which is closest to zero. For instance, ``Decimal(10).remainder_near(6)``
returns ``Decimal('-2')`` which is closer to zero than ``Decimal('4')``.
If both are equally close, the one chosen will have the same sign as
*self*.
Return the remainder from dividing *self* by *other*. This differs from
``self % other`` in that the sign of the remainder is chosen so as to
minimize its absolute value. More precisely, the return value is
``self - n * other`` where ``n`` is the integer nearest to the exact
value of ``self / other``, and if two integers are equally near then the
even one is chosen.
If the result is zero then its sign will be the sign of *self*.
>>> Decimal(18).remainder_near(Decimal(10))
Decimal('-2')
>>> Decimal(25).remainder_near(Decimal(10))
Decimal('5')
>>> Decimal(35).remainder_near(Decimal(10))
Decimal('-5')
.. method:: rotate(other[, context])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment