:: Re: [Frei0r] [PATCH] Add "colgate",…
Góra strony
Delete this message
Reply to this message
Autor: Steinar H. Gunderson
Data:  
Dla: Minimalistic plugin API for video effects
Temat: Re: [Frei0r] [PATCH] Add "colgate", a new color correction plugin.
On Wed, Sep 19, 2012 at 09:05:58PM +0200, Marko Cebokli wrote:
> what about (unsigned char)roundf()?


Does MSVC have roundf? It's defined in exactly the same standards as rintf
(C99, POSIX).

In any case, it has most of the same problems as (int)(x + 0.5) has
(I assume you meant int or long, not unsigned char; the latter would surely
be a disaster); it needs a slow round-with-truncate, and it has a rounding
bias, so it rounds e.g. 0.5 wrong. It's somewhat better with negative
numbers, though.

/* Steinar */
--
Homepage: http://www.sesse.net/