四舍五入取整round、向下取整 floor、向上取整 ceil和去除小数点取整trunc C++

#include<cmath>

value   round   floor   ceil    trunc
----- ----- ----- ---- ----- 2.3     2.0     2.0     3.0     2.0
3.8     4.0     3.0     4.0     3.0
5.5     6.0     5.0     6.0     5.0
-2.3 -2.0 -3.0 -2.0 -2.0 -3.8 -4.0 -4.0 -3.0 -3.0 -5.5 -6.0 -6.0 -5.0 -5.0
    原文作者:WX_ming
    原文地址: https://blog.csdn.net/WX_ming/article/details/82178397
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞