开发者

How do i round off the number ?? for example x=0.688773 and i want x=0.689

开发者 https://www.devze.com 2023-02-17 09:20 出处:网络
How do i round off the number ?? for example x=0.688773 and i want x=0.6开发者_如何学编程89What kind of number is it? If it\'s a float, then you can say:

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

精彩评论

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