java的double类型如何精确到一位小数?
//分钟转小时 vacationNum = (double)Math.round(vacationNum/60*10)/10.0; overTimeNum = (double)Math.round(overTimeNum/60*10)/10.0; 依次类推: 精确到3位小数:
overTimeNum = (double)Math.round(overTimeNum/60*1000)/1000.0;
本文共 277 字,大约阅读时间需要 1 分钟。
java的double类型如何精确到一位小数?
//分钟转小时 vacationNum = (double)Math.round(vacationNum/60*10)/10.0; overTimeNum = (double)Math.round(overTimeNum/60*10)/10.0; 依次类推: 精确到3位小数:
overTimeNum = (double)Math.round(overTimeNum/60*1000)/1000.0;
转载于:https://www.cnblogs.com/YuyuanNo1/p/8609252.html