javaer 2011-11-03
/** * 四舍五入,保留位数为 * @param numberRound */ function roundFun(numberRound,roundDigit){ //四舍五入,保留位数为roundDigit if (numberRound>=0){ var tempNumber = parseInt((numberRound * Math.pow(10,roundDigit)+0.5))/Math.pow(10,roundDigit); return tempNumber; }else{ numberRound1 = -numberRound var tempNumber = parseInt((numberRound1 * Math.pow(10,roundDigit)+0.5))/Math.pow(10,roundDigit); return -tempNumber; } }