src/js/util/helper.js
function round_to_precision(num, precision, supress_thou_sep) {
	//zero should always be "0"
	if (num === 0) return "0";

	var s = Math.round(num * Math.pow(10,precision)) / Math.pow(10,precision);
	s = s + "";

	s = s.split(".");

	if (s.length == 1) {
		s[1] = "";
	}

	if (s[1].length < precision) {
		s[1] += Array(precision-s[1].length + 1).join("0");
	}

	if (!supress_thou_sep) {
		s[0] = d3.format(",")(parseInt(s[0]));
	}

	if (precision === 0) {
		return s[0];
	}

	return s.join(".");
}
function round_to_precision(num, precision, supress_thou_sep) {
	//zero should always be "0"
	if (num === 0) return "0";

	var s = Math.round(num * Math.pow(10,precision)) / Math.pow(10,precision);
	s = s + "";

	s = s.split(".");

	if (s.length == 1) {
		s[1] = "";
	}

	if (s[1].length < precision) {
		s[1] += Array(precision-s[1].length + 1).join("0");
	}

	if (!supress_thou_sep) {
		s[0] = d3.format(",")(parseInt(s[0]));
	}

	if (precision === 0) {
		return s[0];
	}

	return s.join(".");
}
round_to_precision
Round a number to N decimal places

@param {number} num - Number to be rounded
@param {number} precision - Desired precision
@param {boolean} supress_thou_sep
@static
@memberof helper
@return {number} Rounded number