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 6.0 - <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', a floating-point value, into an integer
    portion, which is stored in 'intptr' and a fractional portion, which
    is returned by the function.

    Returns:    The fractional part of 'x'; 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