= B int ((B * 10) + 0.5) / 10.0; double type B;
/ * +0.5, and if a is 0.5 or go out forward, forward to not less than 0.5, and then cast into int rounded down, just rounded to the nearest integer, I believe that this is a simple method of rounding .
If you need to be rounded a bit, then * then in addition to how many like
For example, to one decimal place * 10 / 10.0
After two * 100 / 100.0
.0 with a representative of floating-point operations well, so it will not be done in addition to the int
*/