Add 0.5
before casting to int
. If your system supports it, you can call the C99 round()
function, but I prefer to avoid it for portability reasons.
Add 0.5
before casting to int
. If your system supports it, you can call the C99 round()
function, but I prefer to avoid it for portability reasons.