blob: 8ab978dd726bb8b1b4e1a166a02732ffbeff573b [file]
<html lang="en">
<head>
<title>signbit - Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Math.html#Math" title="Math">
<link rel="prev" href="scalbn.html#scalbn" title="scalbn">
<link rel="next" href="sin.html#sin" title="sin">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="signbit"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="sin.html#sin">sin</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="scalbn.html#scalbn">scalbn</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Math.html#Math">Math</a>
<hr>
</div>
<h3 class="section">1.51 <code>signbit</code>&ndash;Does floating-point number have negative sign?</h3>
<p><a name="index-signbit-139"></a><strong>Synopsis</strong>
<pre class="example"> #include &lt;math.h&gt;
int signbit(real-floating <var>x</var>);
</pre>
<p><strong>Description</strong><br>
The <code>signbit</code> macro determines whether the sign of its argument value is
negative. The macro reports the sign of all values, including infinities,
zeros, and NaNs. If zero is unsigned, it is treated as positive. As shown in
the synopsis, the argument is "real-floating," meaning that any of the real
floating-point types (float, double, etc.) may be given to it.
<p>Note that because of the possibilities of signed 0 and NaNs, the expression
"<var>x</var> &lt; 0.0" does not give the same result as <code>signbit</code> in all cases.
<p><br>
<strong>Returns</strong><br>
The <code>signbit</code> macro returns a nonzero value if and only if the sign of its
argument value is negative.
<p><br>
<strong>Portability</strong><br>
C99, POSIX.
<p><br>
</body></html>