Guardian C Library Calls Reference Manual

Reference to Library Calls
Guardian TNS C Library Calls Reference Manual128833 3-125
modf
modf
The modf function splits a floating-point number into integral and fractional parts.
expr
is an expression of type double.
int_part
points to the variable of type double where modf stores the integral part of expr.
Return Value
is the fractional part of expr.
Example
This example prints “The fractional part is 0.234000. The integral part is 1.000000.”:
#include <stdioh>
#include <mathh>
int main(void)
{
double r, x, y;
x = 1.234;
r = modf(x, &y);
printf("The fractional part is %f. ", r);
printf("The integral part is %f.\n", y);
}
#include <mathh>
double modf(double expr, double *int_part);