function round(num : number, precision : number) : number {
precision = Math.pow(10, precision)
return Math.ceil(num * precision) / precision
}
console.log(round(179.178, 1));
console.log(round(179.178, 2));
console.log(round(179.178, 3));
console.log(round(179.978, 1));
console.log(round(179.978, 2));
console.log(round(179.978, 3));
/*
run:
179.2
179.18
179.178
180
179.98
179.978
*/