round the number in number format

This commit is contained in:
Anand Doshi 2013-03-22 13:28:36 +05:30
parent 2c5ceffd2c
commit e7d4d461eb

View file

@ -17,13 +17,13 @@ window.format_number = function(v, format, decimals){
}
info = get_number_format_info(format);
v = flt(v, null, format);
//Fix the decimal first, toFixed will auto fill trailing zero.
decimals = decimals || info.precision;
v = flt(v, decimals, format);
if(v<0) var is_negative = true;
v = Math.abs(v);
//Fix the decimal first, toFixed will auto fill trailing zero.
decimals = decimals || info.precision;
v = v.toFixed(decimals);