As strange as it may seems, I can't find how to cleanly convert a float
to an int
.
This technique
int int_value = (int)(float_value + 0.5);
triggers a
warning: use of old-style cast
in gcc.
So, what is the modern-style, simple way to convert a float
to an int
? (I accept the loss of precision of course)