2008-01-19 18:08:21 -04:00
|
|
|
.. highlightlang:: c
|
|
|
|
|
|
|
|
.. _floatobjects:
|
|
|
|
|
|
|
|
Floating Point Objects
|
|
|
|
----------------------
|
|
|
|
|
|
|
|
.. index:: object: floating point
|
|
|
|
|
|
|
|
|
|
|
|
.. ctype:: PyFloatObject
|
|
|
|
|
|
|
|
This subtype of :ctype:`PyObject` represents a Python floating point object.
|
|
|
|
|
|
|
|
|
|
|
|
.. cvar:: PyTypeObject PyFloat_Type
|
|
|
|
|
|
|
|
.. index:: single: FloatType (in modules types)
|
|
|
|
|
|
|
|
This instance of :ctype:`PyTypeObject` represents the Python floating point
|
|
|
|
type. This is the same object as ``float`` and ``types.FloatType``.
|
|
|
|
|
|
|
|
|
|
|
|
.. cfunction:: int PyFloat_Check(PyObject *p)
|
|
|
|
|
|
|
|
Return true if its argument is a :ctype:`PyFloatObject` or a subtype of
|
|
|
|
:ctype:`PyFloatObject`.
|
|
|
|
|
|
|
|
.. versionchanged:: 2.2
|
|
|
|
Allowed subtypes to be accepted.
|
|
|
|
|
|
|
|
|
|
|
|
.. cfunction:: int PyFloat_CheckExact(PyObject *p)
|
|
|
|
|
|
|
|
Return true if its argument is a :ctype:`PyFloatObject`, but not a subtype of
|
|
|
|
:ctype:`PyFloatObject`.
|
|
|
|
|
|
|
|
.. versionadded:: 2.2
|
|
|
|
|
|
|
|
|
|
|
|
.. cfunction:: PyObject* PyFloat_FromString(PyObject *str, char **pend)
|
|
|
|
|
|
|
|
Create a :ctype:`PyFloatObject` object based on the string value in *str*, or
|
|
|
|
*NULL* on failure. The *pend* argument is ignored. It remains only for
|
|
|
|
backward compatibility.
|
|
|
|
|
|
|
|
|
|
|
|
.. cfunction:: PyObject* PyFloat_FromDouble(double v)
|
|
|
|
|
|
|
|
Create a :ctype:`PyFloatObject` object from *v*, or *NULL* on failure.
|
|
|
|
|
|
|
|
|
|
|
|
.. cfunction:: double PyFloat_AsDouble(PyObject *pyfloat)
|
|
|
|
|
|
|
|
Return a C :ctype:`double` representation of the contents of *pyfloat*. If
|
|
|
|
*pyfloat* is not a Python floating point object but has a :meth:`__float__`
|
|
|
|
method, this method will first be called to convert *pyfloat* into a float.
|
|
|
|
|
|
|
|
|
|
|
|
.. cfunction:: double PyFloat_AS_DOUBLE(PyObject *pyfloat)
|
|
|
|
|
|
|
|
Return a C :ctype:`double` representation of the contents of *pyfloat*, but
|
|
|
|
without error checking.
|
|
|
|
|
|
|
|
|
|
|
|
.. cfunction:: PyObject* PyFloat_GetInfo(void)
|
|
|
|
|
|
|
|
Return a structseq instance which contains information about the
|
|
|
|
precision, minimum and maximum values of a float. It's a thin wrapper
|
|
|
|
around the header file :file:`float.h`.
|
|
|
|
|
|
|
|
.. versionadded:: 2.6
|
|
|
|
|
|
|
|
|
Merged revisions 74008,74021-74022,74074-74075,74077,74148,74179,74188,74192-74194,74200,74205 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74008 | benjamin.peterson | 2009-07-15 02:46:42 +0200 (Mi, 15 Jul 2009) | 1 line
update year
........
r74021 | georg.brandl | 2009-07-16 09:33:04 +0200 (Do, 16 Jul 2009) | 1 line
#6486: start with built in functions rather than "built in objects".
........
r74022 | georg.brandl | 2009-07-16 09:38:35 +0200 (Do, 16 Jul 2009) | 1 line
#6481: fix typo in os.system() replacement.
........
r74074 | georg.brandl | 2009-07-18 11:03:10 +0200 (Sa, 18 Jul 2009) | 1 line
#6513: fix example code: warning categories are classes, not instances.
........
r74075 | georg.brandl | 2009-07-18 11:06:31 +0200 (Sa, 18 Jul 2009) | 1 line
#6505: fix typos.
........
r74077 | georg.brandl | 2009-07-18 11:43:40 +0200 (Sa, 18 Jul 2009) | 1 line
#6489: fix an ambiguity in getiterator() documentation.
........
r74148 | ezio.melotti | 2009-07-21 22:18:27 +0200 (Di, 21 Jul 2009) | 1 line
#6536 fixed typo
........
r74179 | ezio.melotti | 2009-07-22 23:08:49 +0200 (Mi, 22 Jul 2009) | 1 line
#6423 has_key -> in
........
r74188 | benjamin.peterson | 2009-07-23 16:25:31 +0200 (Do, 23 Jul 2009) | 1 line
use bools
........
r74192 | georg.brandl | 2009-07-24 18:28:38 +0200 (Fr, 24 Jul 2009) | 1 line
Fix arg types of et#.
........
r74193 | georg.brandl | 2009-07-24 18:46:38 +0200 (Fr, 24 Jul 2009) | 1 line
Dont put "void" in signature for nullary functions.
........
r74194 | georg.brandl | 2009-07-24 22:09:46 +0200 (Fr, 24 Jul 2009) | 1 line
#6564: fix section about the two raise syntaxes.
........
r74200 | georg.brandl | 2009-07-25 15:02:15 +0200 (Sa, 25 Jul 2009) | 1 line
#6571: add index entries for more operators.
........
r74205 | georg.brandl | 2009-07-26 15:36:39 +0200 (So, 26 Jul 2009) | 1 line
#6576: fix cross-refs in re docs.
........
2009-10-27 11:34:21 -03:00
|
|
|
.. cfunction:: double PyFloat_GetMax()
|
2008-01-19 18:08:21 -04:00
|
|
|
|
|
|
|
Return the maximum representable finite float *DBL_MAX* as C :ctype:`double`.
|
|
|
|
|
|
|
|
.. versionadded:: 2.6
|
|
|
|
|
|
|
|
|
Merged revisions 74008,74021-74022,74074-74075,74077,74148,74179,74188,74192-74194,74200,74205 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74008 | benjamin.peterson | 2009-07-15 02:46:42 +0200 (Mi, 15 Jul 2009) | 1 line
update year
........
r74021 | georg.brandl | 2009-07-16 09:33:04 +0200 (Do, 16 Jul 2009) | 1 line
#6486: start with built in functions rather than "built in objects".
........
r74022 | georg.brandl | 2009-07-16 09:38:35 +0200 (Do, 16 Jul 2009) | 1 line
#6481: fix typo in os.system() replacement.
........
r74074 | georg.brandl | 2009-07-18 11:03:10 +0200 (Sa, 18 Jul 2009) | 1 line
#6513: fix example code: warning categories are classes, not instances.
........
r74075 | georg.brandl | 2009-07-18 11:06:31 +0200 (Sa, 18 Jul 2009) | 1 line
#6505: fix typos.
........
r74077 | georg.brandl | 2009-07-18 11:43:40 +0200 (Sa, 18 Jul 2009) | 1 line
#6489: fix an ambiguity in getiterator() documentation.
........
r74148 | ezio.melotti | 2009-07-21 22:18:27 +0200 (Di, 21 Jul 2009) | 1 line
#6536 fixed typo
........
r74179 | ezio.melotti | 2009-07-22 23:08:49 +0200 (Mi, 22 Jul 2009) | 1 line
#6423 has_key -> in
........
r74188 | benjamin.peterson | 2009-07-23 16:25:31 +0200 (Do, 23 Jul 2009) | 1 line
use bools
........
r74192 | georg.brandl | 2009-07-24 18:28:38 +0200 (Fr, 24 Jul 2009) | 1 line
Fix arg types of et#.
........
r74193 | georg.brandl | 2009-07-24 18:46:38 +0200 (Fr, 24 Jul 2009) | 1 line
Dont put "void" in signature for nullary functions.
........
r74194 | georg.brandl | 2009-07-24 22:09:46 +0200 (Fr, 24 Jul 2009) | 1 line
#6564: fix section about the two raise syntaxes.
........
r74200 | georg.brandl | 2009-07-25 15:02:15 +0200 (Sa, 25 Jul 2009) | 1 line
#6571: add index entries for more operators.
........
r74205 | georg.brandl | 2009-07-26 15:36:39 +0200 (So, 26 Jul 2009) | 1 line
#6576: fix cross-refs in re docs.
........
2009-10-27 11:34:21 -03:00
|
|
|
.. cfunction:: double PyFloat_GetMin()
|
2008-01-19 18:08:21 -04:00
|
|
|
|
|
|
|
Return the minimum normalized positive float *DBL_MIN* as C :ctype:`double`.
|
|
|
|
|
|
|
|
.. versionadded:: 2.6
|
2008-02-04 14:00:12 -04:00
|
|
|
|
|
|
|
|
Merged revisions 74008,74021-74022,74074-74075,74077,74148,74179,74188,74192-74194,74200,74205 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74008 | benjamin.peterson | 2009-07-15 02:46:42 +0200 (Mi, 15 Jul 2009) | 1 line
update year
........
r74021 | georg.brandl | 2009-07-16 09:33:04 +0200 (Do, 16 Jul 2009) | 1 line
#6486: start with built in functions rather than "built in objects".
........
r74022 | georg.brandl | 2009-07-16 09:38:35 +0200 (Do, 16 Jul 2009) | 1 line
#6481: fix typo in os.system() replacement.
........
r74074 | georg.brandl | 2009-07-18 11:03:10 +0200 (Sa, 18 Jul 2009) | 1 line
#6513: fix example code: warning categories are classes, not instances.
........
r74075 | georg.brandl | 2009-07-18 11:06:31 +0200 (Sa, 18 Jul 2009) | 1 line
#6505: fix typos.
........
r74077 | georg.brandl | 2009-07-18 11:43:40 +0200 (Sa, 18 Jul 2009) | 1 line
#6489: fix an ambiguity in getiterator() documentation.
........
r74148 | ezio.melotti | 2009-07-21 22:18:27 +0200 (Di, 21 Jul 2009) | 1 line
#6536 fixed typo
........
r74179 | ezio.melotti | 2009-07-22 23:08:49 +0200 (Mi, 22 Jul 2009) | 1 line
#6423 has_key -> in
........
r74188 | benjamin.peterson | 2009-07-23 16:25:31 +0200 (Do, 23 Jul 2009) | 1 line
use bools
........
r74192 | georg.brandl | 2009-07-24 18:28:38 +0200 (Fr, 24 Jul 2009) | 1 line
Fix arg types of et#.
........
r74193 | georg.brandl | 2009-07-24 18:46:38 +0200 (Fr, 24 Jul 2009) | 1 line
Dont put "void" in signature for nullary functions.
........
r74194 | georg.brandl | 2009-07-24 22:09:46 +0200 (Fr, 24 Jul 2009) | 1 line
#6564: fix section about the two raise syntaxes.
........
r74200 | georg.brandl | 2009-07-25 15:02:15 +0200 (Sa, 25 Jul 2009) | 1 line
#6571: add index entries for more operators.
........
r74205 | georg.brandl | 2009-07-26 15:36:39 +0200 (So, 26 Jul 2009) | 1 line
#6576: fix cross-refs in re docs.
........
2009-10-27 11:34:21 -03:00
|
|
|
.. cfunction:: int PyFloat_ClearFreeList()
|
2008-02-04 14:00:12 -04:00
|
|
|
|
2008-07-06 00:35:58 -03:00
|
|
|
Clear the float free list. Return the number of items that could not
|
|
|
|
be freed.
|
2008-02-04 14:00:12 -04:00
|
|
|
|
|
|
|
.. versionadded:: 2.6
|