diff options
| author | Craig Jennings <c@cjennings.net> | 2025-08-14 22:58:58 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2025-08-14 22:58:58 -0500 |
| commit | 82ba818ff456bcd6d56a06226e3f27e98fbb55c3 (patch) | |
| tree | 158cfc17b2f644a10f063cb546752cfaae12c97f /devdocs/c/numeric%2Fcomplex%2Fi.html | |
| parent | 9278ddd4ea1a8b1a4c1edaa8894516e3f48d245b (diff) | |
| download | dotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.tar.gz dotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.zip | |
removing all downloaded devdocs files
Diffstat (limited to 'devdocs/c/numeric%2Fcomplex%2Fi.html')
| -rw-r--r-- | devdocs/c/numeric%2Fcomplex%2Fi.html | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/devdocs/c/numeric%2Fcomplex%2Fi.html b/devdocs/c/numeric%2Fcomplex%2Fi.html deleted file mode 100644 index d1d3f90d..00000000 --- a/devdocs/c/numeric%2Fcomplex%2Fi.html +++ /dev/null @@ -1,45 +0,0 @@ - <h1 id="firstHeading" class="firstHeading">I </h1> <table class="t-dcl-begin"> <tr class="t-dsc-header"> <th> Defined in header <code><complex.h></code> </th> <th> </th> <th> </th> </tr> <tr class="t-dcl t-since-c99"> <td> <pre data-language="c">#define I /* unspecified */</pre> -</td> <td class="t-dcl-nopad"> </td> <td> <span class="t-mark-rev t-since-c99">(since C99)</span> </td> </tr> </table> <p>The <code>I</code> macro expands to either <code><a href="complex_i" title="c/numeric/complex/Complex I">_Complex_I</a></code> or <code><a href="imaginary_i" title="c/numeric/complex/Imaginary I">_Imaginary_I</a></code>. If the implementation does not support imaginary types, then the macro always expands to <code><a href="complex_i" title="c/numeric/complex/Complex I">_Complex_I</a></code>.</p> -<p>A program may undefine and perhaps then redefine the macro <code>I</code>.</p> -<h3 id="Notes"> Notes</h3> <p>The macro is not named <code>i</code>, which is the name of the imaginary unit in mathematics, because the name <code>i</code> was already used in many C programs, e.g. as a loop counter variable.</p> -<p>The macro <code>I</code> is often used to form complex numbers, with expressions such as <code>x + y*I</code>. If <code>I</code> is defined as <code><a href="complex_i" title="c/numeric/complex/Complex I">_Complex_I</a></code>, then such expression may create a value with imaginary component <code>+0.0</code> even when <code>y</code> is <code>-0.0</code>, which is significant for complex number functions with branch cuts. The macro <code><a href="cmplx" title="c/numeric/complex/CMPLX">CMPLX</a></code> provides a way to construct a complex number precisely.</p> -<p>GCC provides a non-portable extension that allows imaginary constants to be specified with the suffix <code>i</code> on integer literals: <code>1.0fi</code>, <code>1.0i</code>, and <code>1.0li</code> are imaginary units in GNU C. A similar approach is part of standard C++ as of C++14 (<code>1.0if</code>, <code>1.0i</code>, and <code>1.0il</code> are the imaginary units in C++)</p> -<h3 id="Example"> Example</h3> <div class="t-example"> <div class="c source-c"><pre data-language="c">#include <stdio.h> -#include <complex.h> - -int main(void) -{ - printf("I = %.1f%+.1fi\n", creal(I), cimag(I)); - - double complex z1 = I * I; // imaginary unit squared - printf("I * I = %.1f%+.1fi\n", creal(z1), cimag(z1)); - - double complex z = 1.0 + 2.0*I; // usual way to form a complex number pre-C11 - printf("z = %.1f%+.1fi\n", creal(z), cimag(z)); -}</pre></div> <p>Output:</p> -<div class="text source-text"><pre data-language="c">I = 0.0+1.0i -I * I = -1.0+0.0i -z = 1.0+2.0i</pre></div> </div> <h3 id="References"> References</h3> <ul> -<li> C11 standard (ISO/IEC 9899:2011): </li> -<ul> -<li> 7.3.1/6 I (p: 188) </li> -<li> G.6/1 I (p: 537) </li> -</ul> -<li> C99 standard (ISO/IEC 9899:1999): </li> -<ul> -<li> 7.3.1/4 I (p: 170) </li> -<li> G.6/1 I (p: 472) </li> -</ul> -</ul> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td> <div><a href="imaginary_i" title="c/numeric/complex/Imaginary I"> <span class="t-lines"><span>_Imaginary_I</span></span></a></div> -<div><span class="t-lines"><span><span class="t-mark-rev t-since-c99">(C99)</span></span></span></div> </td> <td> the imaginary unit constant i <br> <span class="t-mark">(macro constant)</span> </td> -</tr> <tr class="t-dsc"> <td> <div><a href="complex_i" title="c/numeric/complex/Complex I"> <span class="t-lines"><span>_Complex_I</span></span></a></div> -<div><span class="t-lines"><span><span class="t-mark-rev t-since-c99">(C99)</span></span></span></div> </td> <td> the complex unit constant i <br> <span class="t-mark">(macro constant)</span> </td> -</tr> <tr class="t-dsc"> <td> <div><a href="cmplx" title="c/numeric/complex/CMPLX"> <span class="t-lines"><span>CMPLX</span><span>CMPLXF</span><span>CMPLXL</span></span></a></div> -<div><span class="t-lines"><span><span class="t-mark-rev t-since-c11">(C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> constructs a complex number from real and imaginary parts <br> <span class="t-mark">(function macro)</span> </td> -</tr> <tr class="t-dsc"> <td colspan="2"> <span><a href="https://en.cppreference.com/w/cpp/numeric/complex/operator%22%22i" title='cpp/numeric/complex/operator""i'>C++ documentation</a></span> for <code>operator""i</code> </td> -</tr> </table> <div class="_attribution"> - <p class="_attribution-p"> - © cppreference.com<br>Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.<br> - <a href="https://en.cppreference.com/w/c/numeric/complex/I" class="_attribution-link">https://en.cppreference.com/w/c/numeric/complex/I</a> - </p> -</div> |
