fmod, fmodl

Aus RAD Studio
Wechseln zu: Navigation, Suche

Nach oben zu math.h - Index


Header-Datei

math.h

Kategorie

Mathematische Routinen

Prototyp

double fmod(double x, double y);

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

Beschreibung

Berechnet x modulo y, den Restwert von x/y.

fmod berechnet x modulo y (den Restwert f, wobei x = ay + f für eine Ganzzahl a und 0 < f < y).

fmodl ist die long double-Version. Sie benötigt ein Argument vom Typ long double und gibt ein Ergebnis vom Typ long double zurück.

Rückgabewert

fmod und fmodl geben den Restwert f zurück, wobei x = ay + f (siehe oben). Wenn y = 0, geben fmod und fmodl 0 zurück.

Beispiel



 #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;
 }



Portabilität



POSIX Win32 ANSI C ANSI C++

fmod

+

+

+

+

fmodl

+

+

+