blob: 093f64f5fb0a38defd5805a24d0441477bd77677 [file]
<html lang="en">
<head>
<title>ilogb - 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="hypot.html#hypot" title="hypot">
<link rel="next" href="infinity.html#infinity" title="infinity">
<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="ilogb"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="infinity.html#infinity">infinity</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="hypot.html#hypot">hypot</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Math.html#Math">Math</a>
<hr>
</div>
<h3 class="section">1.28 <code>ilogb</code>, <code>ilogbf</code>&mdash;get exponent of floating-point number</h3>
<p><a name="index-ilogb-75"></a><a name="index-ilogbf-76"></a><strong>Synopsis</strong>
<pre class="example"> #include &lt;math.h&gt;
int ilogb(double <var>val</var>);
int ilogbf(float <var>val</var>);
</pre>
<p><strong>Description</strong><br>
<p>All nonzero, normal numbers can be described as <var>m</var> *
2**<var>p</var>. <code>ilogb</code> and <code>ilogbf</code> examine the argument
<var>val</var>, and return <var>p</var>. The functions <code>frexp</code> and
<code>frexpf</code> are similar to <code>ilogb</code> and <code>ilogbf</code>, but also
return <var>m</var>.
<p><br>
<strong>Returns</strong><br>
<p><code>ilogb</code> and <code>ilogbf</code> return the power of two used to form the
floating-point argument.
If <var>val</var> is <code>0</code>, they return <code>FP_ILOGB0</code>.
If <var>val</var> is infinite, they return <code>INT_MAX</code>.
If <var>val</var> is NaN, they return <code>FP_ILOGBNAN</code>.
(<code>FP_ILOGB0</code> and <code>FP_ILOGBNAN</code> are defined in math.h, but in turn are
defined as INT_MIN or INT_MAX from limits.h. The value of FP_ILOGB0 may be
either INT_MIN or -INT_MAX. The value of FP_ILOGBNAN may be either INT_MAX or
INT_MIN.)
<!-- The bugs might not be worth noting, given the mass non-C99/POSIX -->
<!-- behavior of much of the Newlib math library. -->
<!-- BUGS -->
<!-- On errors, errno is not set per C99 and POSIX requirements even if -->
<!-- (math_errhandling & MATH_ERRNO) is non-zero. -->
<p><br>
<strong>Portability</strong><br>
C99, POSIX
<p><br>
</body></html>