Everything

modf


Divide floating-point number into integer and decimal

[Classification]

Mathematical library

[Syntax]

#include <math.h>

double __far modf(double val, double *iptr);

[Return value]

Returns a signed decimal part. The sign of the result is the same as the sign of val.

When val is ±∞, this function returns 0 and sets ±∞ to iptr and macro EDOM to global variable errno.

When val is Not-a-Number, this function returns Not-a-Number and sets Not-a-Number to iptr and macro EDOM to global variable errno.

[Description]

This function divides val into integer and decimal parts, and stores the integer part in *iptr. The sign of the integer and decimal parts is the same as the sign of val.