std::modf,std::modff,std::modfl (3) - Linux Man Pages
Defined in header <cmath>
float modf ( float x, float* iptr );
float modff( float x, float* iptr ); (since C++11)
double modf ( double x, double* iptr ); (1) (2)
long double modf ( long double x, long double* iptr ); (3)
long double modfl( long double x, long double* iptr ); (since C++11)
1-3) Decomposes given floating point value x into integral and fractional parts, each having the same type and sign as x. The integral part (in floating-point format) is stored in the object pointed to by iptr.
x - floating point value
iptr - pointer to floating point value to store the integral part to
If no errors occur, returns the fractional part of x with the same sign as x. The integral part is put into the value pointed to by iptr.
The sum of the returned value and the value stored in *iptr gives x (allowing for rounding)
This function is not subject to any errors specified in math_errhandling.
If the implementation supports IEEE floating-point arithmetic (IEC 60559),
* If x is ±0, ±0 is returned, and ±0 is stored in *iptr.
* If x is ±∞, ±0 is returned, and ±∞ is stored in *iptr.
* If x is NaN, NaN is returned, and NaN is stored in *iptr.
* The returned value is exact, the_current_rounding_mode is ignored
This function behaves as if implemented as follows:
Compares different floating-point decomposition functions
// Run this code
truncl nearest integer not greater in magnitude than the given value