function format(expr, decplaces) {
	// raise incoming value by power of 10 times the
	// number of decimal places; round to an integer; convert to string
	var str = "" + Math.round (eval(expr) * Math.pow(10,decplaces))
	// pad small value strings with zeros to the left of rounded number
	while (str.length <= decplaces) {
		str = "0" + str
	}
	// establish location of decimal point
	var decpoint = str.length - decplaces
	// assemble final result from: (a) the string up to the position of
	// the decimal point; (b) the decimal point; and (c) the balance
	// of the string. Return finished product.
	return str.substring(0,decpoint) + "." + str.substring(decpoint,str.length);
}
// turn incoming expression into a decimal value
function decimal(expr) {
	return format(expr,2)
}
