| <html lang="en"> |
| <head> |
| <title>modf - 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="matherr.html#matherr" title="matherr"> |
| <link rel="next" href="nan.html#nan" title="nan"> |
| <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="modf"></a> |
| <p> |
| Next: <a rel="next" accesskey="n" href="nan.html#nan">nan</a>, |
| Previous: <a rel="previous" accesskey="p" href="matherr.html#matherr">matherr</a>, |
| Up: <a rel="up" accesskey="u" href="Math.html#Math">Math</a> |
| <hr> |
| </div> |
| |
| <h3 class="section">1.41 <code>modf</code>, <code>modff</code>—split fractional and integer parts</h3> |
| |
| <p><a name="index-modf-117"></a><a name="index-modff-118"></a><strong>Synopsis</strong> |
| <pre class="example"> #include <math.h> |
| double modf(double <var>val</var>, double *<var>ipart</var>); |
| float modff(float <var>val</var>, float *<var>ipart</var>); |
| |
| </pre> |
| <p><strong>Description</strong><br> |
| <code>modf</code> splits the double <var>val</var> apart into an integer part |
| and a fractional part, returning the fractional part and |
| storing the integer part in <code>*</code><var>ipart</var>. No rounding |
| whatsoever is done; the sum of the integer and fractional |
| parts is guaranteed to be exactly equal to <var>val</var>. That |
| is, if <var>realpart</var> = modf(<var>val</var>, &<var>intpart</var>); then |
| `<var>realpart</var><code>+</code><var>intpart</var>' is the same as <var>val</var>. |
| <code>modff</code> is identical, save that it takes and returns |
| <code>float</code> rather than <code>double</code> values. |
| |
| <p><br> |
| <strong>Returns</strong><br> |
| The fractional part is returned. Each result has the same |
| sign as the supplied argument <var>val</var>. |
| |
| <p><br> |
| <strong>Portability</strong><br> |
| <code>modf</code> is ANSI C. <code>modff</code> is an extension. |
| |
| <p><br> |
| |
| </body></html> |
| |