Rounding float number
You can cast it to an integer after adding an offset. 

Casting to an int will lower the value to the lowest integer value (e.g. 0.9975 will become 0). However, if you want an accuracy of 0.5 (e.g. all values from 0.5 &lt;= x &lt; 1.5 should be 1.0), than add 0.5, thus:

int roundedValue = (int)(0.9975 + 0.5);


If you use constants and want to calculate with it, either add .0 to it, or use a f(loat) or d(ouble) postfix, e.g.:

float f = 12.0 / 3.0;


or

float f = 12f / 3f;


Than calculate the rounded value:

int roundedValue = (int)(f + 0.5);