| <html lang="en"> |
| <head> |
| <title>frexp - 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="fpclassify.html#fpclassify" title="fpclassify"> |
| <link rel="next" href="gamma.html#gamma" title="gamma"> |
| <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="frexp"></a> |
| <p> |
| Next: <a rel="next" accesskey="n" href="gamma.html#gamma">gamma</a>, |
| Previous: <a rel="previous" accesskey="p" href="fpclassify.html#fpclassify">fpclassify</a>, |
| Up: <a rel="up" accesskey="u" href="Math.html#Math">Math</a> |
| <hr> |
| </div> |
| |
| <h3 class="section">1.25 <code>frexp</code>, <code>frexpf</code>—split floating-point number</h3> |
| |
| <p><a name="index-frexp-61"></a><a name="index-frexpf-62"></a><strong>Synopsis</strong> |
| <pre class="example"> #include <math.h> |
| double frexp(double <var>val</var>, int *<var>exp</var>); |
| float frexpf(float <var>val</var>, int *<var>exp</var>); |
| |
| </pre> |
| <p><strong>Description</strong><br> |
| All nonzero, normal numbers can be described as <var>m</var> * 2**<var>p</var>. |
| <code>frexp</code> represents the double <var>val</var> as a mantissa <var>m</var> |
| and a power of two <var>p</var>. The resulting mantissa will always |
| be greater than or equal to <code>0.5</code>, and less than <code>1.0</code> (as |
| long as <var>val</var> is nonzero). The power of two will be stored |
| in <code>*</code><var>exp</var>. |
| |
| <p><var>m</var> and <var>p</var> are calculated so that |
| <var>val</var> is <var>m</var> times <code>2</code> to the power <var>p</var>. |
| |
| <p><code>frexpf</code> is identical, other than taking and returning |
| floats rather than doubles. |
| |
| <p><br> |
| <strong>Returns</strong><br> |
| <code>frexp</code> returns the mantissa <var>m</var>. If <var>val</var> is <code>0</code>, infinity, |
| or Nan, <code>frexp</code> will set <code>*</code><var>exp</var> to <code>0</code> and return <var>val</var>. |
| |
| <p><br> |
| <strong>Portability</strong><br> |
| <code>frexp</code> is ANSI. |
| <code>frexpf</code> is an extension. |
| |
| <p><br> |
| |
| </body></html> |
| |