Math.floor和Math..ceil()的使用方法

以下语句的结果是
Math.floor(-8.5)=( )

答案:(double)-9.0

floor: 求小于参数的最大整数。返回double类型 n. 地板,地面
例如:Math.floor(-4.2) = -5.0

ceil: 求大于参数的最小整数。返回double类型 vt. 装天花板;
例如:Math.ceil(5.6) = 6.0

round: 对小数进行四舍五入后的结果。返回int类型
例如:Math.round(-4.6) = -5

posted @ 2021-08-24 11:28  fridays  阅读(449)  评论(0)    收藏  举报