10 examples of 'javascript round down' in JavaScript

Every line of 'javascript round down' 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.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
4function round(v, n) {
5 return +(Math.round(v + 'e+' + n) + 'e-' + n);
6}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

57export function round (n, decimals = 0) {
58 return Number(`${Math.round(`${n}e${decimals}`)}e-${decimals}`);
59}
5export function round(
6 n: number,
7 precision: number = defaultPrecision,
8): number {
9 return +n.toFixed(precision)
10}
590function round(num, precision) {
591 return Math.round(num * Math.pow(10, precision)) / Math.pow(10, precision);
592}
61export function roundDown(
62 value: BigNumber.Value,
63 decimals: number = 2,
64 roundingTolerance: number = 0
65): BigNumber {
66 if (roundingTolerance) {
67 value = new BigNumber(value).decimalPlaces(
68 decimals + roundingTolerance,
69 BigNumber.ROUND_HALF_DOWN
70 )
71 }
72 return new BigNumber(value).decimalPlaces(decimals, BigNumber.ROUND_DOWN)
73}
32function round2(number) {
33 return Math.round(number * 100) / 100;
34}
61function round(n){
62 return Math.round(n*100000)/100000;
63}
33round() {
34 return new _ExactMath(arguments, 'round')._rounding();
35}
185function round2(n) {
186 return Math.round(n * 100) / 100;
187}
196function roundFunction( src, index )
197{
198 for (var i = 0; i < 8; i++) {
199 tmp2[i] = src[index+i];
200 }
201
202 expansion( tmp2, 0 );
203 substitutionBox( tmp2, 0 );
204 transposition( tmp2, 0 );
205
206 src[index+0] ^= tmp2[4];
207 src[index+1] ^= tmp2[5];
208 src[index+2] ^= tmp2[6];
209 src[index+3] ^= tmp2[7];
210}

Related snippets