If you can guarantee that your number can fit inside an int (or a long), do this:


long temp = 100.0 * f;
f = temp/100.0;

Or, in one line:


f = ((long)(100.0*f))/100.0;