You are here : Cmath.hmodf

modf() - math.h

The C library function double modf(double x, double *integer) returns the fraction component (part after the decimal), and sets integer to the integer component.


Syntax

double modf(double x, double *integer)


Example

#include<stdio.h>
#include<math.h>

int main ()
{
   double x, fractpart, intpart;

   x = 8.123456;
   fractpart = modf(x, &intpart);

   printf("Integral part = %lf\n", intpart);
   printf("Fraction Part = %lf \n", fractpart);
   
   return(0);
}


Output / Return Value

Integral part = 8.000000
Fraction Part = 0.123456


Limitations


Alternatives / See Also


Reference