I need a simple floating point rounding function, thus:
double round(double); round(0.1) = 0 round(-0.1) = 0 round(-0.9) = -1
I can find
It's usually implemented as floor(value + 0.5).
floor(value + 0.5)
Edit: and it's probably not called round since there are at least three rounding algorithms I know of: round to zero, round to closest integer, and banker's rounding. You are asking for round to closest integer.