[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Runden




>>>>> Tobias Ceglarek writes:

Tobias> Mit welcher Funktion kann man runden ?

Versuch mal "man round" - auf halbwegs aktuellen Implementationen
liefert das:

NAME
       round,  roundf,  roundl  -  round to nearest integer, away
       from zero

SYNOPSIS
       #include <math.h>

       double round(double x);
       float roundf(float x);
       long double roundl(long double x);

DESCRIPTION
       These functions round x to the nearest integer, but  round
       halfway  cases  away  from zero (regardless of the current
       ger like rint().

RETURN VALUE
       The rounded integer value. If x is integral or infinite, x
       itself is returned.

[...]

Siehe auch rint(3). Wie man sich solche Funktionen selbst baut mit
Hilfe von Casts ist eine kleine Knobelaufgabe fuer das Wochenende. ;-)

/js

-- 
Juergen Schoenwaelder    <http://www.informatik.uni-osnabrueck.de/schoenw/>