📜  javascript 四舍五入 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:23.735000             🧑  作者: Mango

代码示例4
//standard round function, except round .5 down instead of up
function roundHalfDown(num) {
  return -Math.round(-num);
}
roundHalfDown(1.5);// 1
roundHalfDown(1.6);// 2