Single precision and long double precision floating-point remainder fmodf fmodl

suggest change

fmodf and fmodl return the floating-point remainder of x / y, with the same sign as x. If y is zero, a domain error occurs. Inspecting the numeric result is not a portable way to detect it; see Standard Math.

Single Precision:

#include <math.h> /* for fmodf() */
#include <stdio.h> /* for printf() */

int main(void)
{
    float x = 10.0;
    float y = 5.1;

    float modulus = fmodf(x, y);

    printf("%.5f\n", modulus);
}
4.90000

Long double precision:

#include <math.h> /* for fmodl() */
#include <stdio.h> /* for printf() */

int main(void)
{
    long double x = 10.0;
    long double y = 5.1;

    long double modulus = fmodl(x, y);

    printf("%.5Lf\n", modulus);
}
4.90000

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents