8000 Use round only if realy needed · etherscan-io/Ethplorer@3201968 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3201968

Browse files
committed
Use round only if realy needed
1 parent 0df7035 commit 3201968

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

js/ethplorer.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2132,11 +2132,14 @@ Ethplorer = {
21322132
}
21332133
return res;
21342134
}
2135-
2135+
var parts = num.toString().split('.');
21362136
if(withDecimals){
2137-
num = math('round', num, decimals);
2137+
if(parts.length > 1){
2138+
if(parts[1].length > decimals){
2139+
num = math('round', num, decimals);
2140+
}
2141+
}
21382142
}
2139-
var parts = num.toString().split('.');
21402143
var res = parts[0].toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
21412144
var zeroCount = cutZeroes ? 2 : decimals;
21422145
if(withDecimals && decimals){

0 commit comments

Comments
 (0)
0