 | CARM User's Guide Discontinued |  |
|
|
| modf| Summary |
#include <math.h>
double modf (
double val, /* value to calculate modulo for */
double *ip); /* integer portion of modulo */
| | Description | The modf function splits the floating-point number val into integer and fractional components. The fractional part of val is returned as a signed floating-point number. The integer part is stored as a floating-point number at ip. | | Return Value | The modf function returns the signed fractional part of val. | | Example |
#include <math.h>
#include <stdio.h> /* for printf */
void tst_modf (void) {
float x;
float int_part, frc_part;
x = 123.456;
frc_part = modf (x, &int_part);
printf ("%f = %f + %f\n", x, int_part,frc_part);
}
|
|
|