概述
数轴:-5 -4 -3 -2 -1 0 1 2 3 4 5
就是括号内的数+0.5之后,向下取值
System.out.println("1.9:__"+Math.round(1.4));// 输出1.9:__1
System.out.println("1.8:__"+Math.round(1.3));// 输出1.8:__1
System.out.println("1.7:__"+Math.round(1.2));// 输出1.7:__1
System.out.println("1.6:__"+Math.round(1.1));// 输出1.6:__1
System.out.println("1.5:__"+Math.round(1.0));// 输出1.5:__1
System.out.println("1.4:__"+Math.round(0.9));// 输出1.4:__1
System.out.println("1.3:__"+Math.round(0.8));// 输出1.3:__1
System.out.println("1.2:__"+Math.round(0.7));// 输出1.2:__1
System.out.println("1.1:__"+Math.round(0.6));// 输出1.1:__1
System.out.println("1.0:__"+Math.round(0.5));// 输出1.0:__1
System.out.println("0.9:__"+Math.round(0.4));// 输出0.9:__0
System.out.println("0.8:__"+Math.round(0.3));// 输出0.8:__0
System.out.println("0.7:__"+Math.round(0.2));// 输出0.7:__0
System.out.println("0.6:__"+Math.round(0.1));// 输出0.6:__0
System.out.println("0.5:__"+Math.round(0.0));// 输出0.5:__0
System.out.println("0.4:__"+Math.round(-0.1));// 输出0.4:__0
System.out.println("0.3:__"+Math.round(-0.2));// 输出0.3:__0
System.out.println("0.2:__"+Math.round(-0.3));// 输出0.2:__0
System.out.println("0.1:__"+Math.round(-0.4));// 输出0.1:__0
System.out.println("0.0:__"+Math.round(-0.5));// 输出0.0:__0
System.out.println("-0.1:__"+Math.round(-0.6));// 输出-0.1:__-1
System.out.println("-0.2:__"+Math.round(-0.7));// 输出-0.2:__-1
System.out.println("-0.3:__"+Math.round(-0.8));// 输出-0.3:__-1
System.out.println("-0.4:__"+Math.round(-0.9));// 输出-0.4:__-1
System.out.println("-0.5:__"+Math.round(-1.0));// 输出-0.5:__-1
System.out.println("-0.6:__"+Math.round(-1.1));// 输出-0.6:__-1
System.out.println("-0.7:__"+Math.round(-1.2));// 输出-0.7:__-1
System.out.println("-0.8:__"+Math.round(-1.3));// 输出-0.8:__-1
System.out.println("-0.9:__"+Math.round(-1.4));// 输出-0.9:__-1
System.out.println("-1.0:__"+Math.round(-1.5));// 输出-1.0:__-1
System.out.println("-1.1:__"+Math.round(-1.6));// 输出-1.1:__-2
System.out.println("-1.2:__"+Math.round(-1.7));// 输出-1.2:__-2
System.out.println("-1.3:__"+Math.round(-1.8));// 输出-1.3:__-2
System.out.println("-1.4:__"+Math.round(-1.9));// 输出-1.4:__-2
System.out.println("-1.5:__"+Math.round(-2.0));// 输出-1.5:__-2
System.out.println("-1.6:__"+Math.round(-2.1));// 输出-1.6:__-2
System.out.println("-1.7:__"+Math.round(-2.2));// 输出-1.7:__-2
System.out.println("-1.8:__"+Math.round(-2.3));// 输出-1.8:__-2
System.out.println("-1.9:__"+Math.round(-2.4));// 输出-1.9:__-2
最后
以上就是乐观可乐为你收集整理的math.round的四舍六入五成双的全部内容,希望文章能够帮你解决math.round的四舍六入五成双所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复