function correctNum(value){function l(v,p){return(v+'').split('.')[p].length;}
var digits=l(1/3,1)-l(Math.abs(value),0)-1;var pow=Math.pow(10,digits);return Math.round(value*pow)/pow;}
