开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜