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%2Fmath%2Fsignbit.html | |
new repository
Diffstat (limited to 'devdocs/c/numeric%2Fmath%2Fsignbit.html')
| -rw-r--r-- | devdocs/c/numeric%2Fmath%2Fsignbit.html | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/devdocs/c/numeric%2Fmath%2Fsignbit.html b/devdocs/c/numeric%2Fmath%2Fsignbit.html new file mode 100644 index 00000000..dc7e42da --- /dev/null +++ b/devdocs/c/numeric%2Fmath%2Fsignbit.html @@ -0,0 +1,35 @@ + <h1 id="firstHeading" class="firstHeading">signbit</h1> <table class="t-dcl-begin"> <tr class="t-dsc-header"> <th> Defined in header <code><math.h></code> </th> <th> </th> <th> </th> </tr> <tr class="t-dcl t-since-c99"> <td> <pre data-language="c">#define signbit( arg ) /* implementation defined */</pre> +</td> <td class="t-dcl-nopad"> </td> <td> <span class="t-mark-rev t-since-c99">(since C99)</span> </td> </tr> </table> <p>Determines if the given floating point number <code>arg</code> is negative. The macro returns an integral value.</p> +<h3 id="Parameters"> Parameters</h3> <table class="t-par-begin"> <tr class="t-par"> <td> arg </td> <td> - </td> <td> floating point value </td> +</tr> +</table> <h3 id="Return_value"> Return value</h3> <p>Nonzero integral value if <code>arg</code> is negative, <code>0</code> otherwise.</p> +<h3 id="Notes"> Notes</h3> <p>This macro detects the sign bit of zeroes, infinities, and NaNs. Along with <code><a href="copysign" title="c/numeric/math/copysign">copysign</a></code>, this macro is one of the only two portable ways to examine the sign of a NaN.</p> +<h3 id="Example"> Example</h3> <div class="t-example"> <div class="c source-c"><pre data-language="c">#include <math.h> +#include <stdio.h> + +int main(void) +{ + printf("signbit(+0.0) = %d\n", signbit(+0.0)); + printf("signbit(-0.0) = %d\n", signbit(-0.0)); +}</pre></div> <p>Possible output:</p> +<div class="text source-text"><pre data-language="c">signbit(+0.0) = 0 +signbit(-0.0) = 128</pre></div> </div> <h3 id="References"> References</h3> <ul> +<li> C23 standard (ISO/IEC 9899:2023): </li> +<ul><li> 7.12.3.6 The signbit macro (p: TBD) </li></ul> +<li> C17 standard (ISO/IEC 9899:2018): </li> +<ul><li> 7.12.3.6 The signbit macro (p: TBD) </li></ul> +<li> C11 standard (ISO/IEC 9899:2011): </li> +<ul><li> 7.12.3.6 The signbit macro (p: 237) </li></ul> +<li> C99 standard (ISO/IEC 9899:1999): </li> +<ul><li> 7.12.3.6 The signbit macro (p: 218) </li></ul> +</ul> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td> <div><a href="fabs" title="c/numeric/math/fabs"> <span class="t-lines"><span>fabs</span><span>fabsf</span><span>fabsl</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 absolute value of a floating-point value (\(\small{|x|}\)|x|) <br> <span class="t-mark">(function)</span> </td> +</tr> <tr class="t-dsc"> <td> <div><a href="copysign" title="c/numeric/math/copysign"> <span class="t-lines"><span>copysign</span><span>copysignf</span><span>copysignl</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> produces a value with the magnitude of a given value and the sign of another given value <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/math/signbit" title="cpp/numeric/math/signbit">C++ documentation</a></span> for <code>signbit</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/math/signbit" class="_attribution-link">https://en.cppreference.com/w/c/numeric/math/signbit</a> + </p> +</div> |
