Every line of 'javascript round to 2 digits' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
11 function roundOne(decimalNumber) { 12 return roundTo(decimalNumber, 1); 13 }
32 function round2(number) { 33 return Math.round(number * 100) / 100; 34 }
1 export function round(value: any, decimals: any) { 2 if (!decimals) decimals = 0; 3 return Number(Math.round(Number(value + 'e' + decimals)) + 'e-' + decimals); 4 }
59 function round(value, decimals) { 60 return Number(Math.round(value + 'e' + decimals) + 'e-' + decimals); 61 }
185 function round2(n) { 186 return Math.round(n * 100) / 100; 187 }
118 export function round1(num: number) { 119 if (+num.toPrecision(4) === (num | 0)) return num; 120 else return num.toPrecision(4); 121 }
456 function roundPrecision (x, d, places = 2) { 457 return (Math.floor(x * d) / d).toFixed(places); 458 }
277 function round_decimals(original_number, decimals) { 278 var result1 = original_number * Math.pow(10, decimals) 279 var result2 = Math.round(result1) 280 var result3 = result2 / Math.pow(10, decimals) 281 return pad_with_zeros(result3, decimals) 282 }
157 static round(value, decimals) { 158 return Number(`${Math.round(`${value}e${decimals}`)}e-${decimals}`) 159 }
1694 function precisionRound(number, precision) { 1695 var factor = Math.pow(10, precision); 1696 return Math.round(number * factor) / factor; 1697 }