Number.prototype.round = function (len) {
var old = this;
var a1 = Math.pow(10, len) * old;
a1 = Math.round(a1);
var oldstr = old.toString()
var start = oldstr.indexOf(“.”);
if (start > 0 && oldstr.split(“.”)[1].length == len + 1) {
if (oldstr.substr(start + len + 1, 1) == 5) {
var flagval = oldstr.substr(start + len, 1) – 0;
if (flagval % 2 == 0) {
a1 = a1 – 1;
}
}
}
var b1 = a1 / Math.pow(10, len);
return b1;
}
Number.prototype.oldtoFixed = Number.prototype.toFixed;
Number.prototype.toFixed = function (len) {
var old = this;
var oldstr = old.toString()
var start = oldstr.indexOf(“.”);
if (len == 2 && start > 0 && oldstr.split(“.”)[1].length == 3) {
return this.round(len);
}
else {
return this.oldtoFixed(len);
}
}