| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="STYLESHEET" href="api.css" type='text/css' /> |
| 5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> |
| 6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> |
| 7 | <link rel="first" href="api.html" title='Python/C API Reference Manual' /> |
| 8 | <link rel='contents' href='contents.html' title="Contents" /> |
| 9 | <link rel='index' href='genindex.html' title='Index' /> |
| 10 | <link rel='last' href='about.html' title='About this document...' /> |
| 11 | <link rel='help' href='about.html' title='About this document...' /> |
| 12 | <link rel="next" href="complexObjects.html" /> |
| 13 | <link rel="prev" href="longObjects.html" /> |
| 14 | <link rel="parent" href="numericObjects.html" /> |
| 15 | <link rel="next" href="complexObjects.html" /> |
| 16 | <meta name='aesop' content='information' /> |
| 17 | <title>7.2.4 Floating Point Objects </title> |
| 18 | </head> |
| 19 | <body> |
| 20 | <DIV CLASS="navigation"> |
| 21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 23 | <tr> |
| 24 | <td class='online-navigation'><a rel="prev" title="7.2.3 Long Integer Objects" |
| 25 | href="longObjects.html"><img src='../icons/previous.png' |
| 26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 27 | <td class='online-navigation'><a rel="parent" title="7.2 Numeric Objects" |
| 28 | href="numericObjects.html"><img src='../icons/up.png' |
| 29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 30 | <td class='online-navigation'><a rel="next" title="7.2.5 Complex Number Objects" |
| 31 | href="complexObjects.html"><img src='../icons/next.png' |
| 32 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 33 | <td align="center" width="100%">Python/C API Reference Manual</td> |
| 34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 35 | href="contents.html"><img src='../icons/contents.png' |
| 36 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 37 | <td class='online-navigation'><img src='../icons/blank.png' |
| 38 | border='0' height='32' alt='' width='32' /></td> |
| 39 | <td class='online-navigation'><a rel="index" title="Index" |
| 40 | href="genindex.html"><img src='../icons/index.png' |
| 41 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 42 | </tr></table> |
| 43 | <div class='online-navigation'> |
| 44 | <b class="navlabel">Previous:</b> |
| 45 | <a class="sectref" rel="prev" href="longObjects.html">7.2.3 Long Integer Objects</A> |
| 46 | <b class="navlabel">Up:</b> |
| 47 | <a class="sectref" rel="parent" href="numericObjects.html">7.2 Numeric Objects</A> |
| 48 | <b class="navlabel">Next:</b> |
| 49 | <a class="sectref" rel="next" href="complexObjects.html">7.2.5 Complex Number Objects</A> |
| 50 | </div> |
| 51 | <hr /></div> |
| 52 | </DIV> |
| 53 | <!--End of Navigation Panel--> |
| 54 | |
| 55 | <H2><A NAME="SECTION009240000000000000000"></A><A NAME="floatObjects"></A> |
| 56 | <BR> |
| 57 | 7.2.4 Floating Point Objects |
| 58 | </H2> |
| 59 | |
| 60 | <P> |
| 61 | <a id='l2h-419' xml:id='l2h-419'></a><dl><dt><b><tt class="ctype"><a id='l2h-420' xml:id='l2h-420'>PyFloatObject</a></tt></b></dt> |
| 62 | <dd> |
| 63 | This subtype of <tt class="ctype">PyObject</tt> represents a Python floating point |
| 64 | object. |
| 65 | </dl> |
| 66 | |
| 67 | <P> |
| 68 | <dl><dt>PyTypeObject <b><tt id='l2h-421' xml:id='l2h-421' class="cdata">PyFloat_Type</tt></b></dt> |
| 69 | <dd> |
| 70 | This instance of <tt class="ctype">PyTypeObject</tt> represents the Python floating |
| 71 | point type. This is the same object as <code>types.FloatType</code>. |
| 72 | <a id='l2h-423' xml:id='l2h-423'></a></dd></dl> |
| 73 | |
| 74 | <P> |
| 75 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"><td><nobr>int <b><tt id='l2h-424' xml:id='l2h-424' class="cfunction">PyFloat_Check</tt></b>(</nobr></td><td>PyObject *<var>p</var>)</td></tr></table></dt> |
| 76 | <dd> |
| 77 | Return true if its argument is a <tt class="ctype">PyFloatObject</tt> or a subtype |
| 78 | of <tt class="ctype">PyFloatObject</tt>. |
| 79 | |
| 80 | <span class="versionnote">Changed in version 2.2: |
| 81 | Allowed subtypes to be accepted.</span> |
| 82 | |
| 83 | </dd></dl> |
| 84 | |
| 85 | <P> |
| 86 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"><td><nobr>int <b><tt id='l2h-425' xml:id='l2h-425' class="cfunction">PyFloat_CheckExact</tt></b>(</nobr></td><td>PyObject *<var>p</var>)</td></tr></table></dt> |
| 87 | <dd> |
| 88 | Return true if its argument is a <tt class="ctype">PyFloatObject</tt>, but not a |
| 89 | subtype of <tt class="ctype">PyFloatObject</tt>. |
| 90 | |
| 91 | <span class="versionnote">New in version 2.2.</span> |
| 92 | |
| 93 | </dd></dl> |
| 94 | |
| 95 | <P> |
| 96 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"><td><nobr>PyObject* <b><tt id='l2h-426' xml:id='l2h-426' class="cfunction">PyFloat_FromString</tt></b>(</nobr></td><td>PyObject *<var>str</var>, char **<var>pend</var>)</td></tr></table></dt> |
| 97 | <dd> |
| 98 | Create a <tt class="ctype">PyFloatObject</tt> object based on the string value in |
| 99 | <var>str</var>, or <tt class="constant">NULL</tt> on failure. The <var>pend</var> argument is ignored. It |
| 100 | remains only for backward compatibility. |
| 101 | </dd></dl> |
| 102 | |
| 103 | <P> |
| 104 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"><td><nobr>PyObject* <b><tt id='l2h-427' xml:id='l2h-427' class="cfunction">PyFloat_FromDouble</tt></b>(</nobr></td><td>double <var>v</var>)</td></tr></table></dt> |
| 105 | <dd> |
| 106 | <div class="refcount-info"> |
| 107 | <span class="label">Return value:</span> |
| 108 | <span class="value">New reference.</span> |
| 109 | </div> |
| 110 | Create a <tt class="ctype">PyFloatObject</tt> object from <var>v</var>, or <tt class="constant">NULL</tt> on |
| 111 | failure. |
| 112 | </dd></dl> |
| 113 | |
| 114 | <P> |
| 115 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"><td><nobr>double <b><tt id='l2h-428' xml:id='l2h-428' class="cfunction">PyFloat_AsDouble</tt></b>(</nobr></td><td>PyObject *<var>pyfloat</var>)</td></tr></table></dt> |
| 116 | <dd> |
| 117 | Return a C <tt class="ctype">double</tt> representation of the contents of |
| 118 | <var>pyfloat</var>. |
| 119 | </dd></dl> |
| 120 | |
| 121 | <P> |
| 122 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"><td><nobr>double <b><tt id='l2h-429' xml:id='l2h-429' class="cfunction">PyFloat_AS_DOUBLE</tt></b>(</nobr></td><td>PyObject *<var>pyfloat</var>)</td></tr></table></dt> |
| 123 | <dd> |
| 124 | Return a C <tt class="ctype">double</tt> representation of the contents of |
| 125 | <var>pyfloat</var>, but without error checking. |
| 126 | </dd></dl> |
| 127 | |
| 128 | <P> |
| 129 | |
| 130 | <DIV CLASS="navigation"> |
| 131 | <div class='online-navigation'> |
| 132 | <p></p><hr /> |
| 133 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 134 | <tr> |
| 135 | <td class='online-navigation'><a rel="prev" title="7.2.3 Long Integer Objects" |
| 136 | href="longObjects.html"><img src='../icons/previous.png' |
| 137 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 138 | <td class='online-navigation'><a rel="parent" title="7.2 Numeric Objects" |
| 139 | href="numericObjects.html"><img src='../icons/up.png' |
| 140 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 141 | <td class='online-navigation'><a rel="next" title="7.2.5 Complex Number Objects" |
| 142 | href="complexObjects.html"><img src='../icons/next.png' |
| 143 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 144 | <td align="center" width="100%">Python/C API Reference Manual</td> |
| 145 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 146 | href="contents.html"><img src='../icons/contents.png' |
| 147 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 148 | <td class='online-navigation'><img src='../icons/blank.png' |
| 149 | border='0' height='32' alt='' width='32' /></td> |
| 150 | <td class='online-navigation'><a rel="index" title="Index" |
| 151 | href="genindex.html"><img src='../icons/index.png' |
| 152 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 153 | </tr></table> |
| 154 | <div class='online-navigation'> |
| 155 | <b class="navlabel">Previous:</b> |
| 156 | <a class="sectref" rel="prev" href="longObjects.html">7.2.3 Long Integer Objects</A> |
| 157 | <b class="navlabel">Up:</b> |
| 158 | <a class="sectref" rel="parent" href="numericObjects.html">7.2 Numeric Objects</A> |
| 159 | <b class="navlabel">Next:</b> |
| 160 | <a class="sectref" rel="next" href="complexObjects.html">7.2.5 Complex Number Objects</A> |
| 161 | </div> |
| 162 | </div> |
| 163 | <hr /> |
| 164 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 165 | </DIV> |
| 166 | <!--End of Navigation Panel--> |
| 167 | <ADDRESS> |
| 168 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 169 | </ADDRESS> |
| 170 | </BODY> |
| 171 | </HTML> |