function
<cmath> <ctgmath>
modfdouble modf (double x, double* intpart);
double modf (double x , double* intpart); float modff (float x , float* intpart);long double modfl (long double x, long double* intpart);
double modf (double x , double* intpart); float modf (float x , float* intpart);long double modf (long double x, long double* intpart);
double modf (double x , double* intpart); float modf (float x , float* intpart);long double modf (long double x, long double* intpart); double modf (T x , double* intpart); // additional overloads
Break into fractional and integral parts
Breaks x into an integral and a fractional part.The integer part is stored in the object pointed by intpart, and the fractional part is returned by the function.
Both parts have the same sign as x.
Additional overloadsare provided in this header (
<cmath>
) for the
integral types: These overloads effectively cast
xto a
double
before calculations (defined for
Tbeing any
integral type).
1
2
3
4
5
6
7
8
9
10
11
12
13
/* modf example */
#include <stdio.h> /* printf */
#include <math.h> /* modf */
int main ()
{
double param, fractpart, intpart;
param = 3.14159265;
fractpart = modf (param , &intpart);
printf ("%f = %f + %f \n", param, intpart, fractpart);
return 0;
}
3.141593 = 3.000000 + 0.141593
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4