<dd><p>The complex number value, using the C <aclass="reference internal" href="#c.Py_complex" title="Py_complex"><codeclass="xref c c-type docutils literal notranslate"><spanclass="pre">Py_complex</span></code></a> representation.</p>
<divclass="deprecated-removed">
<p><spanclass="versionmodified deprecated">自從版本 3.15 後不推薦使用,將會自版本 3.20 中移除。: </span>Use <aclass="reference internal" href="#c.PyComplex_AsCComplex" title="PyComplex_AsCComplex"><codeclass="xref c c-func docutils literal notranslate"><spanclass="pre">PyComplex_AsCComplex()</span></code></a> and
<aclass="reference internal" href="#c.PyComplex_FromCComplex" title="PyComplex_FromCComplex"><codeclass="xref c c-func docutils literal notranslate"><spanclass="pre">PyComplex_FromCComplex()</span></code></a> to convert a
Python complex number to/from the C <aclass="reference internal" href="#c.Py_complex" title="Py_complex"><codeclass="xref c c-type docutils literal notranslate"><spanclass="pre">Py_complex</span></code></a>
<h2>作為 C 結構的複數<aclass="headerlink" href="#complex-numbers-as-c-structures" title="連結到這個標頭">¶</a></h2>
<p>The API also provides functions for working with complex numbers, using the
<aclass="reference internal" href="#c.Py_complex" title="Py_complex"><codeclass="xref c c-type docutils literal notranslate"><spanclass="pre">Py_complex</span></code></a> representation. Note that the functions which accept
these structures as parameters and return them as results do so <em>by value</em>
rather than dereferencing them through pointers.</p>
<p>Please note, that these functions are <aclass="reference internal" href="../glossary.html#term-soft-deprecated"><spanclass="xref std std-term">soft deprecated</span></a> since Python
3.15. Avoid using this API in a new code to do complex arithmetic: either use
the <aclass="reference internal" href="number.html#number"><spanclass="std std-ref">Number Protocol</span></a> API or use native complex types, like
<spanclass="c-expr sig sig-inline c"><spanclass="kt">double</span><spanclass="w"></span><spanclass="kt">complex</span></span>.</p>
<dd><p>以 C 的 <aclass="reference internal" href="#c.Py_complex" title="Py_complex"><codeclass="xref c c-type docutils literal notranslate"><spanclass="pre">Py_complex</span></code></a> 表示形式來回傳 <em>num</em> 的 <em>exp</em> 次方的結果。</p>
<p>如果 <em>num</em> 為 null 且 <em>exp</em> 不是正實數,則此方法會回傳零並將 <codeclass="xref c c-data docutils literal notranslate"><spanclass="pre">errno</span></code> 設定為 <codeclass="xref c c-macro docutils literal notranslate"><spanclass="pre">EDOM</span></code>。</p>
<p>Set <codeclass="xref c c-data docutils literal notranslate"><spanclass="pre">errno</span></code> to <codeclass="xref c c-macro docutils literal notranslate"><spanclass="pre">ERANGE</span></code> on overflows.</p>
<dd><p>Return the absolute value of the complex number <em>num</em>.</p>
<p>Set <codeclass="xref c c-data docutils literal notranslate"><spanclass="pre">errno</span></code> to <codeclass="xref c c-macro docutils literal notranslate"><spanclass="pre">ERANGE</span></code> on overflows.</p>