public static long round(double a) 返回最接近参数的 long.结果将舍入为整数:加上 1/2,对结果调用 floor 并将所得结果强制转换为 long 类型.换句话说,结果等于以下表达式的值: (long)Math.floor(a + 0.5d) 按照四舍五入的理解,-11.5约等于-12才对,但是Java中的round采取加上1/2再向下取整的方式,所以在类似这种.5的数据时不能按四舍五入理解. 又测试了下Excel表格,发现它的round函数为四舍五入.…
• Java中的简单浮点数类型float和double不能够进行运算.不光是Java,在其它很多编程语言中也有这样的问题. 如果我们编译运行下面这个程序会看到什么? public class Test { public static void main(String args[]) { System.out.println(0.05 + 0.01); System.out.println(1.0 - 0.42); …
题目: A - Tutor Time Limit:1000MS Memory Limit:65535KB 64bit IO Format:%I64d & %I64u Submit Status Description Lilin was a student of Tonghua Normal University. She is studying at University of Chicago now. Besides studying, she worked as a tut…