Math.round()对负数操作问题
Math.round()对负数操作问题
System.out.println(Math.round(-11.5));为什么得的是-11
而System.out.println(Math.round(-11.51));得的就是-12呢?
System.out.println(Math.round(-11.5));为什么得的是-11
而System.out.println(Math.round(-11.51));得的就是-12呢?
数学人气:654 ℃时间:2020-06-02 19:37:34
优质解答
roundpublic static long round(double a)返回最接近参数的 long.结果将舍入为整数:加上 1/2,对结果调用 floor 并将所得结果强制转换为 long 类型.换句话说,结果等于以下表达式的值:(long)Math.floor(a + 0.5d)特...
我来回答
类似推荐
猜你喜欢
- 1三角形ABc中,AB等于4,D是AB边上的一个动点,DE平行BC,连接DC,设三角形ABC的面积为S,三角形形DCE为S‘
- 2Not to those who have not had the
- 3几道英语填空题(填副词或介词)··帮帮忙
- 4已知关于x的方程-x2+2x=|a-1|在x∈(1/2,2]上恒有实数根,则实数a的取值范围是_.
- 5they keep their secrets to themselves为什么用介词“to”
- 6点到点的距离公式,最好有讲解
- 7运功员攀登一座山峰,上山用18min,沿原路下山时速度加快5/1,运动员下山用多少分钟
- 8一本文学著作,在印刷它的页码时共用了2001个数字,这本书中数字【1】出现了多少?
- 9—what's the m___with you — l have a cold
- 10请问 3.07 ×101-3.07 4.56+7分之3+4.44+7分之4 1.25 ×3.2 ×2.5 【(9+0.25) ×12】/30