diff options
| author | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
| commit | 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch) | |
| tree | f1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/c/numeric%2Fcomplex%2Fcacos.html | |
new repository
Diffstat (limited to 'devdocs/c/numeric%2Fcomplex%2Fcacos.html')
| -rw-r--r-- | devdocs/c/numeric%2Fcomplex%2Fcacos.html | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/devdocs/c/numeric%2Fcomplex%2Fcacos.html b/devdocs/c/numeric%2Fcomplex%2Fcacos.html new file mode 100644 index 00000000..d5f7cc0a --- /dev/null +++ b/devdocs/c/numeric%2Fcomplex%2Fcacos.html @@ -0,0 +1,76 @@ + <h1 id="firstHeading" class="firstHeading">cacosf, cacos, cacosl</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">float complex cacosf( float complex z );</pre> +</td> <td> (1) </td> <td> <span class="t-mark-rev t-since-c99">(since C99)</span> </td> </tr> <tr class="t-dcl t-since-c99"> <td> <pre data-language="c">double complex cacos( double complex z );</pre> +</td> <td> (2) </td> <td> <span class="t-mark-rev t-since-c99">(since C99)</span> </td> </tr> <tr class="t-dcl t-since-c99"> <td> <pre data-language="c">long double complex cacosl( long double complex z );</pre> +</td> <td> (3) </td> <td> <span class="t-mark-rev t-since-c99">(since C99)</span> </td> </tr> <tr class="t-dsc-header"> <th> Defined in header <code><tgmath.h></code> </th> <th> </th> <th> </th> </tr> <tr class="t-dcl t-since-c99"> <td> <pre data-language="c">#define acos( z )</pre> +</td> <td> (4) </td> <td> <span class="t-mark-rev t-since-c99">(since C99)</span> </td> </tr> </table> <div class="t-li1"> +<span class="t-li">1-3)</span> Computes the complex arc cosine of <code>z</code> with branch cuts outside the interval [−1,+1] along the real axis.</div> <div class="t-li1"> +<span class="t-li">4)</span> Type-generic macro: If <code>z</code> has type <code><span class="kw4">long</span> <span class="kw4">double</span> <a href="http://en.cppreference.com/w/c/numeric/complex/complex"><span class="kw743">complex</span></a></code>, <code>cacosl</code> is called. if <code>z</code> has type <code><span class="kw4">double</span> <a href="http://en.cppreference.com/w/c/numeric/complex/complex"><span class="kw743">complex</span></a></code>, <code>cacos</code> is called, if <code>z</code> has type <code><span class="kw4">float</span> <a href="http://en.cppreference.com/w/c/numeric/complex/complex"><span class="kw743">complex</span></a></code>, <code>cacosf</code> is called. If <code>z</code> is real or integer, then the macro invokes the corresponding real function (<code>acosf</code>, <code><a href="http://en.cppreference.com/w/c/numeric/math/acos"><span class="kw673">acos</span></a></code>, <code>acosl</code>). If <code>z</code> is imaginary, then the macro invokes the corresponding complex number version.</div> <h3 id="Parameters"> Parameters</h3> <table class="t-par-begin"> <tr class="t-par"> <td> z </td> <td> - </td> <td> complex argument </td> +</tr> +</table> <h3 id="Return_value"> Return value</h3> <p>If no errors occur, complex arc cosine of <code>z</code> is returned, in the range a strip unbounded along the imaginary axis and in the interval [0; π] along the real axis.</p> +<h3 id="Error_handling_and_special_values"> Error handling and special values</h3> <p>Errors are reported consistent with <a href="../math/math_errhandling" title="c/numeric/math/math errhandling"><code>math_errhandling</code></a>.</p> +<p>If the implementation supports IEEE floating-point arithmetic,</p> +<ul> +<li> <code>cacos<span class="br0">(</span><a href="http://en.cppreference.com/w/c/numeric/complex/conj"><span class="kw760">conj</span></a><span class="br0">(</span>z<span class="br0">)</span><span class="br0">)</span> <span class="sy1">==</span> <a href="http://en.cppreference.com/w/c/numeric/complex/conj"><span class="kw760">conj</span></a><span class="br0">(</span>cacos<span class="br0">(</span>z<span class="br0">)</span><span class="br0">)</span></code> </li> +<li> If <code>z</code> is <code>±0+0i</code>, the result is <code>π/2-0i</code> </li> +<li> If <code>z</code> is <code>±0+NaNi</code>, the result is <code>π/2+NaNi</code> </li> +<li> If <code>z</code> is <code>x+∞i</code> (for any finite x), the result is <code>π/2-∞i</code> </li> +<li> If <code>z</code> is <code>x+NaNi</code> (for any nonzero finite x), the result is <code>NaN+NaNi</code> and <code><a href="../fenv/fe_exceptions" title="c/numeric/fenv/FE exceptions">FE_INVALID</a></code> may be raised. </li> +<li> If <code>z</code> is <code>-∞+yi</code> (for any positive finite y), the result is <code>π-∞i</code> </li> +<li> If <code>z</code> is <code>+∞+yi</code> (for any positive finite y), the result is <code>+0-∞i</code> </li> +<li> If <code>z</code> is <code>-∞+∞i</code>, the result is <code>3π/4-∞i</code> </li> +<li> If <code>z</code> is <code>+∞+∞i</code>, the result is <code>π/4-∞i</code> </li> +<li> If <code>z</code> is <code>±∞+NaNi</code>, the result is <code>NaN±∞i</code> (the sign of the imaginary part is unspecified) </li> +<li> If <code>z</code> is <code>NaN+yi</code> (for any finite y), the result is <code>NaN+NaNi</code> and <code><a href="../fenv/fe_exceptions" title="c/numeric/fenv/FE exceptions">FE_INVALID</a></code> may be raised </li> +<li> If <code>z</code> is <code>NaN+∞i</code>, the result is <code>NaN-∞i</code> </li> +<li> If <code>z</code> is <code>NaN+NaNi</code>, the result is <code>NaN+NaNi</code> </li> +</ul> <h3 id="Notes"> Notes</h3> <p>Inverse cosine (or arc cosine) is a multivalued function and requires a branch cut on the complex plane. The branch cut is conventially placed at the line segments (-∞,-1) and (1,∞) of the real axis. The mathematical definition of the principal value of arc cosine is acos z =</p> +<span><span>1</span><span>/</span><span>2</span></span>π + <i>i</i>ln(<i>i</i>z + <span class="t-mrad"><span>√</span><span>1-z<sup class="t-su">2</sup></span></span>) <p>For any z, acos(z) = π - acos(-z)</p> +<h3 id="Example"> Example</h3> <div class="t-example"> <div class="c source-c"><pre data-language="c">#include <stdio.h> +#include <math.h> +#include <complex.h> + +int main(void) +{ + double complex z = cacos(-2); + printf("cacos(-2+0i) = %f%+fi\n", creal(z), cimag(z)); + + double complex z2 = cacos(conj(-2)); // or CMPLX(-2, -0.0) + printf("cacos(-2-0i) (the other side of the cut) = %f%+fi\n", creal(z2), cimag(z2)); + + // for any z, acos(z) = pi - acos(-z) + double pi = acos(-1); + double complex z3 = ccos(pi-z2); + printf("ccos(pi - cacos(-2-0i) = %f%+fi\n", creal(z3), cimag(z3)); +}</pre></div> <p>Output:</p> +<div class="text source-text"><pre data-language="c">cacos(-2+0i) = 3.141593-1.316958i +cacos(-2-0i) (the other side of the cut) = 3.141593+1.316958i +ccos(pi - cacos(-2-0i) = 2.000000+0.000000i</pre></div> </div> <h3 id="References"> References</h3> <ul> +<li> C11 standard (ISO/IEC 9899:2011): </li> +<ul> +<li> 7.3.5.1 The cacos functions (p: 190) </li> +<li> 7.25 Type-generic math <tgmath.h> (p: 373-375) </li> +<li> G.6.1.1 The cacos functions (p: 539) </li> +<li> G.7 Type-generic math <tgmath.h> (p: 545) </li> +</ul> +<li> C99 standard (ISO/IEC 9899:1999): </li> +<ul> +<li> 7.3.5.1 The cacos functions (p: 172) </li> +<li> 7.22 Type-generic math <tgmath.h> (p: 335-337) </li> +<li> G.6.1.1 The cacos functions (p: 474) </li> +<li> G.7 Type-generic math <tgmath.h> (p: 480) </li> +</ul> +</ul> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td> <div><a href="casin" title="c/numeric/complex/casin"> <span class="t-lines"><span>casin</span><span>casinf</span><span>casinl</span></span></a></div> +<div><span class="t-lines"><span><span class="t-mark-rev t-since-c99">(C99)</span></span><span><span class="t-mark-rev t-since-c99">(C99)</span></span><span><span class="t-mark-rev t-since-c99">(C99)</span></span></span></div> </td> <td> computes the complex arc sine <br> <span class="t-mark">(function)</span> </td> +</tr> <tr class="t-dsc"> <td> <div><a href="catan" title="c/numeric/complex/catan"> <span class="t-lines"><span>catan</span><span>catanf</span><span>catanl</span></span></a></div> +<div><span class="t-lines"><span><span class="t-mark-rev t-since-c99">(C99)</span></span><span><span class="t-mark-rev t-since-c99">(C99)</span></span><span><span class="t-mark-rev t-since-c99">(C99)</span></span></span></div> </td> <td> computes the complex arc tangent <br> <span class="t-mark">(function)</span> </td> +</tr> <tr class="t-dsc"> <td> <div><a href="ccos" title="c/numeric/complex/ccos"> <span class="t-lines"><span>ccos</span><span>ccosf</span><span>ccosl</span></span></a></div> +<div><span class="t-lines"><span><span class="t-mark-rev t-since-c99">(C99)</span></span><span><span class="t-mark-rev t-since-c99">(C99)</span></span><span><span class="t-mark-rev t-since-c99">(C99)</span></span></span></div> </td> <td> computes the complex cosine <br> <span class="t-mark">(function)</span> </td> +</tr> <tr class="t-dsc"> <td> <div><a href="../math/acos" title="c/numeric/math/acos"> <span class="t-lines"><span>acos</span><span>acosf</span><span>acosl</span></span></a></div> +<div><span class="t-lines"><span><span class="t-mark-rev t-since-c99">(C99)</span></span><span><span class="t-mark-rev t-since-c99">(C99)</span></span></span></div> </td> <td> computes arc cosine (\({\small\arccos{x} }\)arccos(x)) <br> <span class="t-mark">(function)</span> </td> +</tr> <tr class="t-dsc"> <td colspan="2"> <span><a href="https://en.cppreference.com/w/cpp/numeric/complex/acos" title="cpp/numeric/complex/acos">C++ documentation</a></span> for <code>acos</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/cacos" class="_attribution-link">https://en.cppreference.com/w/c/numeric/complex/cacos</a> + </p> +</div> |
