function formatFloat1(src, pos)
{
return Math.round(src*Math.pow(10, pos))/Math.pow(10, pos);
}
function formatFloat(src, pos)
{
if (src - parseInt(src) > 0)
{
return Math.round((src-5 * Math.pow(10, -(pos+1)))*Math.pow(10, pos))/Math.pow(10, pos);
}
return src.toFixed(2);
}
function formatFloat3(src)
{
var pointLength = ""+src.replace(/(/d*/.?)/,"").length // 取小数点位数
if (src - parseInt(src) > 0 && pointLength > 2)
{
return ""+src.replace(/^(.*/..{2}).*$/,"$1")// 小数点后两位
}
return eval(src).toFixed(2);
}