fmod, fmodl

De RAD Studio
Aller à : navigation, rechercher

Remonter à Math.h - Index


Header File

math.h

Category

Math Routines

Prototype

double fmod(double x, double y);

long double fmodl(long double x, long double y);

Description

Calculates x modulo y, the remainder of x/y.

fmod calculates x modulo y (the remainder f, where x = ay + f for some integer a, and 0 < f < y).

fmodl is the long double version; it takes long double arguments and returns a long double result.

Return Value

fmod and fmodl return the remainder f where x = ay + f (as described above). When y = 0, fmod and fmodl return 0.

Example



 #include <stdio.h>
 #include <math.h>
 int main(void)
 {
    double x = 5.0, y = 2.0;
    double result;
    result = fmod(x,y);
    printf("The remainder of (%lf / %lf) is %lf\n", x, y, result);
    return 0;
 }



Portability



POSIX Win32 ANSI C ANSI C++

fmod

+

+

+

+

fmodl

+

+

+