Math.round?大侠们帮忙.public class Test {/*** @param args*/public static void main(String[] args) {System.out.println(Math.round(-11.5));System.out.println(Math.round(-12.4));System.out.println(Math.round(-12.5));System.out.println(Math.round(-1

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/10 22:56:31
Math.round?大侠们帮忙.public class Test {/*** @param args*/public static void main(String[] args) {System.out.println(Math.round(-11.5));System.out.println(Math.round(-12.4));System.out.println(Math.round(-12.5));System.out.println(Math.round(-1

Math.round?大侠们帮忙.public class Test {/*** @param args*/public static void main(String[] args) {System.out.println(Math.round(-11.5));System.out.println(Math.round(-12.4));System.out.println(Math.round(-12.5));System.out.println(Math.round(-1
Math.round?大侠们帮忙.
public class Test {
/**
* @param args
*/
public static void main(String[] args) {
System.out.println(Math.round(-11.5));
System.out.println(Math.round(-12.4));
System.out.println(Math.round(-12.5));
System.out.println(Math.round(-12.6));
}
}
显示结果:
-11
-12
-12
-13
这些结果是怎么算出来的?
System.out.println(Math.round(-12.5));
System.out.println(Math.round(-12.6));
-12
-13
怎么结果不一样.
四舍六入五成双是什么意思?

Math.round?大侠们帮忙.public class Test {/*** @param args*/public static void main(String[] args) {System.out.println(Math.round(-11.5));System.out.println(Math.round(-12.4));System.out.println(Math.round(-12.5));System.out.println(Math.round(-1
round(参数)是最接近参数的整数是几,通俗讲就是四舍五入.
但是负数要注意,五入的时候要往大的数入.比如-12.5 就变-12而不是-13因为-12比-13大,
所以以上结果就算出来了