modf, modfl

Aus RAD Studio
Wechseln zu: Navigation, Suche

Nach oben zu math.h - Index


Header-Datei

math.h

Kategorie

Mathematische Routinen

Prototyp

double modf(double x, double *ipart);

long double modfl(long double x, long double *ipart);

Beschreibung

Teilt einen Wert vom Typ double oder long double in einen ganzzahligen Teil und einen Bruchteil auf.

modf teilt den double-Wert x in zwei Teile auf: die Ganzzahl und den Nachkommaanteil. modf speichert die Ganzzahl in ipart und gibt den Nachkommaanteil zurück.

modfl 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

modf und modfl geben den Nachkommaanteil von x zurück.

Beispiel



 #include <math.h>
 #include <stdio.h>
 int main(void)
 {
     double fraction, integer;
     double number = 100000.567;
     fraction = modf(number, &integer);
     printf("The whole and fractional parts of %lf are %lf and %lf\n",
            number, integer, fraction);
     return 0;
 }



Portabilität



POSIX Win32 ANSI C ANSI C++

modf

+

+

+

+

modfl

+

+

+