// 扩大范围 向上取整 function ceilRange(temperature) { var tem; if (temperature > 0) { return Math.ceil(temperature * 1.2); } if (temperature < 0) { return Math.ceil(temperature * 0.8); } if (temperature == 0) { return 0; } } //扩大范围 向下取整 function floorRange(temperature) { if (temperature > 0) { return Math.floor(temperature * 0.8); } if (temperature < 0) { return Math.floor(temperature * 1.2); } if (temperature == 0) { return 0; } }
原文:https://www.cnblogs.com/TheKiteRunner/p/8979726.html