Commit | Line | Data |
---|---|---|
86530b38 AT |
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="node40.html" /> | |
13 | <link rel="prev" href="complexObjects.html" /> | |
14 | <link rel="parent" href="complexObjects.html" /> | |
15 | <link rel="next" href="node40.html" /> | |
16 | <meta name='aesop' content='information' /> | |
17 | <title>7.2.5.1 Complex Numbers as C Structures</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.5 Complex Number Objects" | |
25 | href="complexObjects.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.5 Complex Number Objects" | |
28 | href="complexObjects.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.2 Complex Numbers as" | |
31 | href="node40.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="complexObjects.html">7.2.5 Complex Number Objects</A> | |
46 | <b class="navlabel">Up:</b> | |
47 | <a class="sectref" rel="parent" href="complexObjects.html">7.2.5 Complex Number Objects</A> | |
48 | <b class="navlabel">Next:</b> | |
49 | <a class="sectref" rel="next" href="node40.html">7.2.5.2 Complex Numbers as</A> | |
50 | </div> | |
51 | <hr /></div> | |
52 | </DIV> | |
53 | <!--End of Navigation Panel--> | |
54 | ||
55 | <H3><A NAME="SECTION009251000000000000000"> | |
56 | 7.2.5.1 Complex Numbers as C Structures</A> | |
57 | </H3> | |
58 | ||
59 | <P> | |
60 | Note that the functions which accept these structures as parameters | |
61 | and return them as results do so <em>by value</em> rather than | |
62 | dereferencing them through pointers. This is consistent throughout | |
63 | the API. | |
64 | ||
65 | <P> | |
66 | <dl><dt><b><tt class="ctype"><a id='l2h-431' xml:id='l2h-431'>Py_complex</a></tt></b></dt> | |
67 | <dd> | |
68 | The C structure which corresponds to the value portion of a Python | |
69 | complex number object. Most of the functions for dealing with | |
70 | complex number objects use structures of this type as input or | |
71 | output values, as appropriate. It is defined as: | |
72 | ||
73 | <P> | |
74 | <div class="verbatim"><pre> | |
75 | typedef struct { | |
76 | double real; | |
77 | double imag; | |
78 | } Py_complex; | |
79 | </pre></div> | |
80 | </dl> | |
81 | ||
82 | <P> | |
83 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"><td><nobr>Py_complex <b><tt id='l2h-432' xml:id='l2h-432' class="cfunction">_Py_c_sum</tt></b>(</nobr></td><td>Py_complex <var>left</var>, Py_complex <var>right</var>)</td></tr></table></dt> | |
84 | <dd> | |
85 | Return the sum of two complex numbers, using the C | |
86 | <tt class="ctype">Py_complex</tt> representation. | |
87 | </dd></dl> | |
88 | ||
89 | <P> | |
90 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"><td><nobr>Py_complex <b><tt id='l2h-433' xml:id='l2h-433' class="cfunction">_Py_c_diff</tt></b>(</nobr></td><td>Py_complex <var>left</var>, Py_complex <var>right</var>)</td></tr></table></dt> | |
91 | <dd> | |
92 | Return the difference between two complex numbers, using the C | |
93 | <tt class="ctype">Py_complex</tt> representation. | |
94 | </dd></dl> | |
95 | ||
96 | <P> | |
97 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"><td><nobr>Py_complex <b><tt id='l2h-434' xml:id='l2h-434' class="cfunction">_Py_c_neg</tt></b>(</nobr></td><td>Py_complex <var>complex</var>)</td></tr></table></dt> | |
98 | <dd> | |
99 | Return the negation of the complex number <var>complex</var>, using the C | |
100 | <tt class="ctype">Py_complex</tt> representation. | |
101 | </dd></dl> | |
102 | ||
103 | <P> | |
104 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"><td><nobr>Py_complex <b><tt id='l2h-435' xml:id='l2h-435' class="cfunction">_Py_c_prod</tt></b>(</nobr></td><td>Py_complex <var>left</var>, Py_complex <var>right</var>)</td></tr></table></dt> | |
105 | <dd> | |
106 | Return the product of two complex numbers, using the C | |
107 | <tt class="ctype">Py_complex</tt> representation. | |
108 | </dd></dl> | |
109 | ||
110 | <P> | |
111 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"><td><nobr>Py_complex <b><tt id='l2h-436' xml:id='l2h-436' class="cfunction">_Py_c_quot</tt></b>(</nobr></td><td>Py_complex <var>dividend</var>, | |
112 | Py_complex <var>divisor</var>)</td></tr></table></dt> | |
113 | <dd> | |
114 | Return the quotient of two complex numbers, using the C | |
115 | <tt class="ctype">Py_complex</tt> representation. | |
116 | </dd></dl> | |
117 | ||
118 | <P> | |
119 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"><td><nobr>Py_complex <b><tt id='l2h-437' xml:id='l2h-437' class="cfunction">_Py_c_pow</tt></b>(</nobr></td><td>Py_complex <var>num</var>, Py_complex <var>exp</var>)</td></tr></table></dt> | |
120 | <dd> | |
121 | Return the exponentiation of <var>num</var> by <var>exp</var>, using the C | |
122 | <tt class="ctype">Py_complex</tt> representation. | |
123 | </dd></dl> | |
124 | ||
125 | <P> | |
126 | ||
127 | <DIV CLASS="navigation"> | |
128 | <div class='online-navigation'> | |
129 | <p></p><hr /> | |
130 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
131 | <tr> | |
132 | <td class='online-navigation'><a rel="prev" title="7.2.5 Complex Number Objects" | |
133 | href="complexObjects.html"><img src='../icons/previous.png' | |
134 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
135 | <td class='online-navigation'><a rel="parent" title="7.2.5 Complex Number Objects" | |
136 | href="complexObjects.html"><img src='../icons/up.png' | |
137 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
138 | <td class='online-navigation'><a rel="next" title="7.2.5.2 Complex Numbers as" | |
139 | href="node40.html"><img src='../icons/next.png' | |
140 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
141 | <td align="center" width="100%">Python/C API Reference Manual</td> | |
142 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
143 | href="contents.html"><img src='../icons/contents.png' | |
144 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
145 | <td class='online-navigation'><img src='../icons/blank.png' | |
146 | border='0' height='32' alt='' width='32' /></td> | |
147 | <td class='online-navigation'><a rel="index" title="Index" | |
148 | href="genindex.html"><img src='../icons/index.png' | |
149 | border='0' height='32' alt='Index' width='32' /></A></td> | |
150 | </tr></table> | |
151 | <div class='online-navigation'> | |
152 | <b class="navlabel">Previous:</b> | |
153 | <a class="sectref" rel="prev" href="complexObjects.html">7.2.5 Complex Number Objects</A> | |
154 | <b class="navlabel">Up:</b> | |
155 | <a class="sectref" rel="parent" href="complexObjects.html">7.2.5 Complex Number Objects</A> | |
156 | <b class="navlabel">Next:</b> | |
157 | <a class="sectref" rel="next" href="node40.html">7.2.5.2 Complex Numbers as</A> | |
158 | </div> | |
159 | </div> | |
160 | <hr /> | |
161 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> | |
162 | </DIV> | |
163 | <!--End of Navigation Panel--> | |
164 | <ADDRESS> | |
165 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. | |
166 | </ADDRESS> | |
167 | </BODY> | |
168 | </HTML> |