Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C - <b>modf() split floating point into mantissa and exponent</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
modf()                   Split Floating Point into Mantissa and Exponent

 #include   <math.h>

 double     modf(x,intptr);
 double     x;                           Floating-point value
 double     *intptr;                     Pointer to stored integer portion

    modf() separates 'x' into fractional and integer parts.  '*intptr' is
    set to the integer portion, and the fractional portion is returned.

    Returns:    The fractional part of 'x'.  There is no error return.

  -------------------------------- Example ---------------------------------

    The following statements get the fractional and integer parts of two
    different floating-point values:

          #include <math.h>      /* Required for function declaration only */

          main()
          {
             double f, i;

             f = modf(69.2665, &i);    /* f = 0.2665, i = 69.0 */
             f = modf(-69.2665, &i);   /* f = -0.2665, i = -69.0 */
          }

See Also: fmod() frexp() ldexp()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson