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
268bf4af
Commit
268bf4af
authored
Jun 24, 2008
by
Mark Dickinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rewrite references to Py3k in __floor__, __ceil__ and __round__ documentation.
parent
79edbd51
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
12 deletions
+16
-12
Doc/library/fractions.rst
Doc/library/fractions.rst
+16
-12
No files found.
Doc/library/fractions.rst
View file @
268bf4af
...
...
@@ -21,8 +21,8 @@ Rational number class.
``Fraction`` representing ``numerator/denominator``. If
*denominator* is :const:`0`, raises a :exc:`ZeroDivisionError`. The
second version requires that *other_fraction* is an instance of
:class:`numbers.
Fraction
` and returns an instance of
:class:`
Rational
` with the same value. The third version expects a
:class:`numbers.
Rational
` and returns an instance of
:class:`
Fraction
` with the same value. The third version expects a
string of the form ``[-+]?[0-9]+(/[0-9]+)?``, optionally surrounded
by spaces.
...
...
@@ -40,7 +40,7 @@ Rational number class.
.. method:: from_decimal(dec)
This classmethod constructs a :class:`Fraction` representing the exact
value of *dec*, which must be a :class:`decimal.Decimal`.
value of *dec*, which must be a :class:`decimal.Decimal`
instance
.
.. method:: limit_denominator(max_denominator=1000000)
...
...
@@ -64,24 +64,28 @@ Rational number class.
.. method:: __floor__()
Returns the greatest :class:`int` ``<= self``. Will be accessible through
:func:`math.floor` in Py3k.
Returns the greatest :class:`int` ``<= self``. This method can
also be accessed through the :func:`math.floor` function:
>>> from math import floor
>>> floor(Fraction(355, 113))
3
.. method:: __ceil__()
Returns the least :class:`int` ``>= self``.
Will be accessible through
:func:`math.ceil` in Py3k
.
Returns the least :class:`int` ``>= self``.
This method can
also be accessed through the :func:`math.ceil` function
.
.. method:: __round__()
__round__(ndigits)
The first version returns the nearest :class:`int` to ``self``,
rounding
half to even. The second version rounds ``self`` to the nearest multipl
e
of ``Fraction(1, 10**ndigits)`` (logically, if ``ndigits`` is negative),
again rounding half toward even. Will be accessible through :func:`round`
in Py3k
.
The first version returns the nearest :class:`int` to ``self``,
rounding half to even. The second version rounds ``self`` to th
e
nearest multiple of ``Fraction(1, 10**ndigits)`` (logically, if
``ndigits`` is negative), again rounding half toward even. This
method can also be accessed through the :func:`round` function
.
.. seealso::
...
...
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