Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

round, roundf, roundl - auf nächste ganze Zahl runden

&pagelevel(4)&pagelevel

Definition

#include <math.h>

double round(double x);

float roundf (float x);

long double roundl (long double x);

Die Funktionen geben in Gleitpunktdarstellung jeweils die ganze Zahl zurück, die x am nächsten liegt. round stellt das Ergebnis dar als Zahl vom Typ double, roundf als Zahl vom Typ float und roundl als Zahl vom Typ long double.

Der zurückgegebene Wert ist unabhängig vom eingestellten Rundungsmodus. Wenn die Differenz zwischen x und dem gerundeten Ergebnis genau 0.5 ist, wird die betragsmäßig größere ganze Zahl zurückgegeben.

Returnwert

ganze Zahl

dargestellt als Zahl vom Typ double, float bzw. long double bei Erfolg.

 

undefiniert

bei Über- oder Unterlauf. errno wird auf ERANGE gesetzt, um den Fehler anzuzeigen.

Siehe auch

abs, ceil, floor, llrint, llround, lrint, lround, rint