diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2010-08-04 18:48:34 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2010-08-04 18:48:34 (GMT) |
commit | dd1d8f72f9a2837fdeac3a238009a9bc586a7c19 (patch) | |
tree | 19102eb72808cc243df93d161613d2490694ccbd /Doc | |
parent | d75efd9c560a30224487c43a53313c05e3921c18 (diff) | |
download | cpython-dd1d8f72f9a2837fdeac3a238009a9bc586a7c19.zip cpython-dd1d8f72f9a2837fdeac3a238009a9bc586a7c19.tar.gz cpython-dd1d8f72f9a2837fdeac3a238009a9bc586a7c19.tar.bz2 |
Merged revisions 83732 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r83732 | mark.dickinson | 2010-08-04 19:42:43 +0100 (Wed, 04 Aug 2010) | 3 lines
Issue #9498: Add reference to sys.float_info from 'numeric types' docs.
Thanks Yitz Gale.
........
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/stdtypes.rst | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 0e90c18..c29f50b 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -224,18 +224,20 @@ Numeric Types --- :class:`int`, :class:`float`, :class:`long`, :class:`complex` pair: C; language There are four distinct numeric types: :dfn:`plain integers`, :dfn:`long -integers`, :dfn:`floating point numbers`, and :dfn:`complex numbers`. In +integers`, :dfn:`floating point numbers`, and :dfn:`complex numbers`. In addition, Booleans are a subtype of plain integers. Plain integers (also just called :dfn:`integers`) are implemented using :ctype:`long` in C, which gives them at least 32 bits of precision (``sys.maxint`` is always set to the maximum plain integer value for the current platform, the minimum value is -``-sys.maxint - 1``). Long integers have unlimited precision. Floating point -numbers are implemented using :ctype:`double` in C. All bets on their precision -are off unless you happen to know the machine you are working with. - -Complex numbers have a real and imaginary part, which are each implemented using -:ctype:`double` in C. To extract these parts from a complex number *z*, use -``z.real`` and ``z.imag``. +``-sys.maxint - 1``). Long integers have unlimited precision. Floating point +numbers are usually implemented using :ctype:`double` in C; information about +the precision and internal representation of floating point numbers for the +machine on which your program is running is available in +:data:`sys.float_info`. Complex numbers have a real and imaginary part, which +are each a floating point number. To extract these parts from a complex number +*z*, use ``z.real`` and ``z.imag``. (The standard library includes additional +numeric types, :mod:`fractions` that hold rationals, and :mod:`decimal` that +hold floating-point numbers with user-definable precision.) .. index:: pair: numeric; literals |