Skip to content

Commit c17cf4f

Browse files
committed
Auto increase decimal places for small number
1 parent 5390b05 commit c17cf4f

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88
### Added
9+
- Auto increase decimalPlaces for small number.
910

1011
### Changed
1112
- Change: Rollback the algorithm about deltaTime

main.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,16 @@ let BestDealHelper = {
337337
span.textContent = "";
338338
continue;
339339
}
340-
span.textContent = " 💹" + Beautify(me.cpsAcceleration * 100 / avg, 2) + "%";
340+
// Auto increase decimalPlaces for small number
341+
let value;
342+
for (let i = 0; i < 15; i++) {
343+
value = Beautify(me.cpsAcceleration * 100 / avg, i);
344+
if (value !== "0") {
345+
value = Beautify(me.cpsAcceleration * 100 / avg, i + 1);
346+
break;
347+
}
348+
}
349+
span.textContent = " 💹" + value + "%";
341350
if (me.waitingTime) span.textContent += " ⏳" + me.waitingTime;
342351
if (me.BestHelper) {
343352
MOD.rainbow(span);

0 commit comments

Comments
 (0)