How do i round off the number ?? for example x=0.688773 and i want x=0.689
How do i round off the number ?? for example x=0.688773 and i want x=0.6开发者_如何学编程89
What kind of number is it? If it's a float, then you can say:
myFloat = roundf(1000 * myFloat) / 1000.0;
If it's a double, use the round() function instead.
精彩评论