modf (Windows CE 5.0)
Developing an Application > Microsoft C Run-time Library for Windows CE > Run-time Library Reference
Splits a floating-point value into fractional and integer parts.
double modf( doublex,double*intptr);
Parameters
- x
Floating-point value. - intptr
Pointer to stored integer portion.
Return Values
This function returns the signed fractional portion of x.
There is no error return.
Remarks
The modf function breaks down the floating-point value x into fractional and integer parts, each of which has the same sign as x.
The signed fractional portion of x is returned.
The integer portion is stored as a floating-point value at intptr.
Example
/* MODF.C */
void main( void )
{
double x, y, n;
x = -14.87654321; /* Divide x into its fractional */
y = modf( x, &n ); /* and integer parts */
printf( "For %f, the fraction is %f and the integer is %.f\n",
x, y, n );
}
Output
For -14.876543, the fraction is -0.876543 and the integer is -14
Requirements
OS Versions: Windows CE 2.0 and later.
Header: stdlib.h.
Link Library: coredll.dll.
See Also
Send Feedback on this topic to the authors