Javascript Math roundTo(num, dec)
Math.roundTo = function (num, dec) { return Math.round(num * Math.pow(10, dec)) / Math.pow(10, dec); };